Delete a file that is kept OPEN

  • Thread starter Thread starter jjafer
  • Start date Start date
J

jjafer

Guest
Hi,

Can someone provide tips as how to identify whether a file is kept OPEN or not and if kept OPEN, How to delete the open file?

The file i am talking about is an XL file.

Rgds,
Jafer
 
You can not delete an open file. You will get the runtime error # 70 [permission denied] if you try to delete [Kill()] the open Excel file. You can trap for that specific error and alert the user that they must close the file in question before you can delete the file using the Kill() command.
 
Hudson,
Why not just close it before the deletion?


Jafer,
Hudson posted a routine to close a database when there is an expired time beyond being idle. It's a post about closing a remote database.

I'm not sure what the windows command event is, but if you use Access to open the file, you can just record the time you open it and use timer events to check if it is still open. After a certain elapsed time you can then close it from access. Is this something you may be interested in?

Additionally, what is it that you're trying to do exactly? ADO is a powerful tool for retrieving data. For what you may want to do, you may not even need to see the excel file at all.
 
Hudson,

We actually have excel reports in shared server location, which the users have access. Every week these reports will be replaced with new one. Currently I am experiencing the "Permission denied" error when the MS Access application tries to overwrite them with new reports. This error occurs because some users leave the report open even after using it.
We have no idea who has kept the file OPEN. My requirement is to close or delete the file when the file is OPEN, so that this error will not occur.

Rgds,
Jafer
 

Users who are viewing this thread

Back
Top Bottom