The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Application.Quit Method

Office 2007
Quits Microsoft Excel.



expression   A variable that represents an Application object.


If unsaved workbooks are open when you use this method, Microsoft 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, Microsoft 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, Microsoft Excel will quit without asking you to save the workbook.


This example saves all open workbooks and then quits Microsoft Excel.

Visual Basic for Applications
For Each w In Application.Workbooks
Next w

Community Additions