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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top