DisplayAlerts Property
Applies To
Application object.
Description
True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.
Remarks
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, Microsoft Excel doesn't automatically set it back to True when your macro stops running. Your macro should always set the property back to True when it stops running.
Note This behavior is different from previous versions of Microsoft Excel. In earlier versions, the DisplayAlerts property was automatically reset to True when the macro stopped running. If you have old code that relies on this behavior, you should change your code to explicitly set the property back to True at the end of the macro.
See Also
Interactive property, ScreenUpdating property.
Example
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
Workbooks("BOOK1.XLS").Close
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", _
topic:="C:\WINWORD\FORMLETR.DOC")
Application.DisplayAlerts = True
Application.DDEExecute channelNumber, "[FILEPRINT]"
Application.DDETerminate channelNumber
Application.DisplayAlerts = True