Application-defined or object-defined error

accessman2

Registered User.
Local time
Today, 05:56
Joined
Sep 15, 2005
Messages
335
Hi,

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.

Please let me know, thanks.
 
You can hide the Excel Sheet until your done exporting. Something like this:

yourapplicationvariable.visible = False

and then when the cells are done populating, make it visible:

yourapplicationvariable.visible = True

I've done this on every one of my exports to prevent user activity.
 

Users who are viewing this thread

Back
Top Bottom