Testing for an open file & closing it

  • Thread starter Thread starter acx
  • Start date Start date
A

acx

Hello,

I have got this problem. I want to perform operations on some Excel
file so I have to make sure that this file is closed firstly. I need a
VBA code which tests if a concrete file (C:/File.xls) is open. If it is
it saves this file and closes it.

Many thanks for your help!!

MikeX
 
While you can test whether it's currently open, I don't believe there's any
way that you can close the file if it is. At least, I certainly hope you
can't: someone may be doing work!
 
Douglas,

Thank you for your response. In this case, I am SURE that no other
processes are running in that file (the file is open from HDD). So what
to do...?

Regards,
MikeX
 
So you're saying that you try to open it and can't?

Something must have a handle on the file. Perhaps you opened it in another
automation session, and didn't close Excel properly.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Douglas,

Thank you for your response. In this case, I am SURE that no other
processes are running in that file (the file is open from HDD). So what
to do...?

Regards,
MikeX
 
Back
Top