Thread: Closing Excel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default Closing Excel

Phil,

Application.Quit

Will shut down Excel.
It needs to be placed instead of the .Close statement (once
your workbook is "Closed", any coding after the .Close
statement will not run.
If you want to insure that the user doesn't get any alerts, use
Application.DisplayAlerts = False
before the .Quit statement.
Be aware that doing so will now quit Excel and close all open
workbooks without prompting for a save.

John

Phil wrote:

Help. I have a macro save my open workbooks and close
them. Can anyone provide a line of code to automatically
end my Excel session.

Thanks in advance.