April 2006
Beginner
1114 pages
98h 16m
English
Application.DisplayAlerts [= setting]
True displays standard Excel dialogs while a macro runs; False hides those dialogs and automatically uses the default response for each. Default is True.
Set this property to False for batch operations in which you don’t want user intervention; be sure to reset the property to True when done. For example, the following code closes all workbooks but the current one without saving or prompting the user:
Sub CloseAllNoSave( )
Dim wb As Workbook
' Turn off warnings.
Application.DisplayAlerts = False
For Each wb In Workbooks
' Close all workbooks but this one.
If Not (wb Is ThisWorkbook) Then _
wb.Close
Next
' Turn warnings back on.
Application.DisplayAlerts = True
End SubRead now
Unlock full access