Closing Excel

P

Phil

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.
 
J

John Wilson

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
 
Top