DisplayAlerts Property
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

DisplayAlerts Property [Excel 2003 VBA Language Reference]

Office 2003

True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.


The default value is True. Set this property to False if you don't want to be disturbed by prompts and alert messages while a macro is running; any time a message requires a response, Microsoft Excel chooses the default response.

If you set this property to False, Micorosoft Excel sets this property to True when the code is finished, unless you are running cross process code.

When using the SaveAs method for workbooks to overwrite an existing file, the 'Overwrite' alert has a default of 'No', while the 'Yes' response is selected by Excel when the DisplayAlerts property is set equal to False.


This example closes the workbook Book1.xls and doesn't prompt the user to save changes. Any changes to Book1.xls aren't saved.

Application.DisplayAlerts = False
Application.DisplayAlerts = True

This example suppresses the message that otherwise appears when you initiate a DDE channel to an application that's not running.

Application.DisplayAlerts = False
channelNumber = Application.DDEInitiate( _
    app:="WinWord", _
Application.DisplayAlerts = True
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True

Applies to | Application Object

See Also | Interactive Property | ScreenUpdating Property

© 2016 Microsoft