MrExcel Publishing
Your One Stop for Excel Tips & Solutions

closing excel


Posted by steve on January 11, 2002 8:00 AM

I'm trying to close a spreadsheet without saving any changes.

ActiveWorkbook.Close SaveChanges = false

This wont work.

How can I close Excel without saving any changes or be prompted to? The spreadsheet is read only and a save as box appears.

Thanks in advance


Posted by Richard Winfield on January 11, 2002 8:25 AM


This saves the file to the specified directory and filename without bringing up the save as box, and then closes the active woorkbook.

Sub Filesave
ActiveSheet.SaveAs Filename:="C:\YOUR DIR\" & "YOUR FILENAME.xls"
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub

Rick