Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (29 sloc) 1.29 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date localization_priority
Application.Quit method (Excel)
vbaxl10.chm133194
vbaxl10.chm133194
excel
Excel.Application.Quit
d01de494-95c7-6e3e-3049-f89b31aa9d0c
04/05/2019
Normal

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

[!includeSupport and feedback]

You can’t perform that action at this time.