Unanswered: Application-defined or object-defined error
I have problem for exporting data to the Excel from MS Access.
I wrote the code to export the data to excel
.worksheets(1).cells(1,2) = value
I export the data to Excel worksheets row by row because I want to fix the values in the certain position.
When the program is exporting to Excel worksheets, the Excel application is opened automatically, and then exporting data in the Excel row by row. The environment is in the Excel program. I move the mouse on the worksheets and click on it. Then it stops. I go back to MS Access application. It shows the error message: "Application-defined or object-defined error"
How can I lock/prevent the user to click the mouse on the Excel worksheets until the exporting is done?
Can we make the msgbox in the Excel when exporting? But, if I make the msgbox in the MS Access, the msgbox will NOT be shown in the Excel environment.
Set the Excel Object to hidden by setting the Visible Property to False when you start.
When done, set Excel visible to true again.
Warning: once Excel is hidden, you can only bring it back programatically, or you have to open the task manager and kill it (no other ill effects that I am aware of). This is only a problem if your code crashes, so make sure you have adequate error trapping.