ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing Excel (https://www.excelbanter.com/excel-programming/280965-closing-excel.html)

Phil

Closing Excel
 
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.

John Wilson

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.



steve

Closing Excel
 
Phil,

Application.Quit

--
sb
"Phil" wrote in message
...
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.





All times are GMT +1. The time now is 01:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com