MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Close file without saving changes

Posted by Stacy on April 06, 2001 7:51 AM

I have created a program...'on open' it runs a macro that opens a dbf file and saves it as text and emails the file. Now I need to close the txt file and the xl file which contains the macro. I am just using the 'ActiveWorkbook.Close' command to close them...but I do not want it to prompt me to save changes. I want it to close w/o saving changes and I don't want any boxes to pop up. Can anyone offer some advice on this??? Thanks in advance!!

Posted by lenze on April 06, 2001 9:21 AM


Insert the code
ActiveWorkbook.Saved = True

befor the Close command.

Posted by Tom Urtis on April 07, 2001 8:46 PM

Stacy --

In your Excel's Auto_Close procedure, you can add the following code that will stop those message boxes from appearing as the file closes:

Application.DisplayAlerts = False

Hope that answers your question.

Tom Urtis