ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA - Close without saving changes (https://www.excelbanter.com/excel-discussion-misc-queries/101622-vba-close-without-saving-changes.html)

PaulW

VBA - Close without saving changes
 
The system runs several reports each night, and I have a macro that opens the
report it needs automatically, uses the data, then closes the report.
Even in cases where all i've done is copy data from this report it asks me
occasionally if I want to save changes. Sometimes I do make changes.

Is there a way in a macro that I can set it to automatically close a file
without either saving it, or prompting me?
Any changes to these reports doesn't want to be saved so they can be used by
other people, and I generally like the prompt on a usual basis, but its one I
would rather be without while a macro is running.

Anything I can put before
ActiveWindow.Close
Or in it, or something like that?

[email protected]

VBA - Close without saving changes
 

PaulW wrote:

Anything I can put before
ActiveWindow.Close
Or in it, or something like that?


Hi PaulW

ActiveWorkbook.Close 0

Regards

Steve


bpeltzer

VBA - Close without saving changes
 
ActiveWindow.Close savechanges:=False


"PaulW" wrote:

The system runs several reports each night, and I have a macro that opens the
report it needs automatically, uses the data, then closes the report.
Even in cases where all i've done is copy data from this report it asks me
occasionally if I want to save changes. Sometimes I do make changes.

Is there a way in a macro that I can set it to automatically close a file
without either saving it, or prompting me?
Any changes to these reports doesn't want to be saved so they can be used by
other people, and I generally like the prompt on a usual basis, but its one I
would rather be without while a macro is running.

Anything I can put before
ActiveWindow.Close
Or in it, or something like that?



All times are GMT +1. The time now is 04:40 AM.

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