True if Microsoft Excel displays certain alerts and messages while a macro is running. Read/write Boolean.
expression A variable that represents an Application object.
The default value is True. Set this property to False to suppress prompts and alert messages while a macro is running; when a message requires a response, Microsoft Excel chooses the default response.
If you set this property to False, 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 Confirm Save As dialog box has a default of No, while the Yes response is selected by Excel when the DisplayAlerts property is set to False. The Yes response overwrites the existing file.
When using the SaveAs method for workbooks to save a workbook that contains a Visual Basic for Applications (VBA) project in the Excel 5.0/95 file format, the Microsoft Excel dialog box has a default of Yes, while the Cancel response is selected by Excel when the DisplayAlerts property is set to False. You cannot save a workbook that contains a VBA project by using the Excel 5.0/95 file format.
This example closes the Workbook Book1.xls and does not prompt the user to save changes. Changes to Book1.xls are not 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 is 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