Close workboook if it is open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi! I want to check if a workbook is open. If it is open I want to close it.
The probelm is that if I want to check if it is open and it is not the code
cannot find the sheet at all and thus produces an error. Is there any way I
can check if it is open without getting an error? thanks!
 
I use

Windows(cl).close savechanges = False

where cl is the workbook I want to close, I usually have an "On error resume
next" so that if the workbook isn't there it won't error when it can't close.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top