VBA: Exit Without Saving
You can exit or close Excel without asking the user to save by setting display alerts to False and calling Application.Quit. Here’s some simple example code to exit Excel without prompting the user to save:
Sub ExitWithoutPrompt()
Application.DisplayAlerts = False
Application.Quit
End Sub


but would you want to?????!
Most of the time I post whatever comes to mind or from notes, however sometimes I post relating to people searching this site for topics I haven’t covered, this is the case with this post.
I can’t think of many practical reasons for doing this however – possibly a calculator template that a user can manipulate but should exit without saving the current state?
maybe – sounds like trouble to me though! – even if you’ve cerated a new instance of the excel object
This is just what I was looking for.
Thanks
@ross, mark.
Might not be particularly useful in general Excel use, but has a fantastic use in programming Excel from other applications using COM automation.
appExcel.DisplayAlerts = False
appExcel.Quit
Inside the exception procedure if something else gets ballsed up. This prevents having a hundred EXCEL.EXE processes in the background while you’re debugging, because every “New Excel.Application” spawns a new Excel process.
Worked for me… thanks
Set up a scheduled task to open excel, query an sql database, create a new (non-query) workbook with the results. Attached the new workbook to an email and sent it.
works a treat, the only bit I was missing was displayalerts = false!
thanks!!!!