Check To See If Excel File Is Open

Lynn_AccessUser

Registered User.
Local time
Today, 05:01
Joined
Feb 4, 2003
Messages
125
I have code that runs and upon completion an excel spreadsheet is opened. What I would like to do before the code runs is to check to see if the spreadsheet is already open. If the spreadsheet is open it will give the user a msgbox telling them to close the spreadsheet first. If the spreadsheet is not open, the code will then run.

The reason behind this madness is that the spreadsheet that is opened is linked to another spreadsheet and the code runs a dts package. If the spreadsheet is open it can not run the dts package which updates the data. I have the code written if the package fails to execute it will give the user a msgbox. Problem is that it takes so long to fail that it basically makes it look like the app is locked up so I would prefer to prevent the users from even getting to that point.

Thanks!!!
 
I have a similar problem.
One thing that I am looking into now, is if we could make a macro in Excel that would create a file (perhaps a .txt) in the directory on opening and another macro that would delete that file on closing. If this can be done, looking for the existance of the .txt file would be easier than looking at if the .xls file is open. I am not sure, but that is what I am trying to do right now.
If I find a solution, I'll tell you.
If you find a better solution or find a way to do what I am looking for, please reply.

Thank you and good luck.
 

Users who are viewing this thread

Back
Top Bottom