Close file without saving data

  • Thread starter Thread starter ExcelMonkey
  • Start date Start date
E

ExcelMonkey

I have a routine where I open a file and make temporary changes to it.
When I close it, I do not want to be prompted to save changes. I d
not want to save the changes. They code I am using looks like this:

Windows(FilenameVar &".xls").Activate
ActiveWindow.Close

How to code it so that I am not prompted for saving?

Thanks
 
Hi
try

Windows(FilenameVar &".xls").Activate
Application.DisplayAlerts = False
ActiveWindow.Close
Application.DisplayAlerts = True

you could also use

Application.DisplayAlerts = False
Workbooks(FilenameVar &".xls").close
Application.DisplayAlerts = True
 

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