Application.Quit method (Excel)
Quits Microsoft Excel.
Syntax
expression.Quit
expression A variable that represents an Application object.
Remarks
If unsaved workbooks are open when you use this method, Excel displays a dialog box asking whether you want to save the changes. You can prevent this by saving all workbooks before using the Quit method or by setting the DisplayAlerts property to False. When this property is False, Excel doesn't display the dialog box when you quit with unsaved workbooks; it quits without saving them.
If you set the Saved property for a workbook to True without saving the workbook to the disk, Excel will quit without asking you to save the workbook.
Example
This example saves all open workbooks and then quits Excel.
For Each w In Application.Workbooks
w.Save
Next w
Application.Quit
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.