ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close file without saving data (https://www.excelbanter.com/excel-programming/293233-close-file-without-saving-data.html)

ExcelMonkey[_96_]

Close file without saving data
 
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

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Close file without saving data
 
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

--
Regards
Frank Kabel
Frankfurt, Germany

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 do
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.


---
Message posted from http://www.ExcelForum.com/



Vasant Nanavati

Close file without saving data
 
Workbooks(FilenameVar &".xls").Close False

--

Vasant

"ExcelMonkey " wrote in message
...
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 do
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.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com