Share via


DisplayAlerts Property

WdAlertLevel

WdAlertLevel can be one of these WdAlertLevel constants.
wdAlertsAll All message boxes and alerts are displayed; errors are returned to the macro.
wdAlertsMessageBox Only message boxes are displayed; errors are trapped and returned to the macro.
wdAlertsNone No alerts or message boxes are displayed. If a macro encounters a message box, the default value is chosen and the macro continues.

expression.DisplayAlerts

expression Required. An expression that returns one of the objects in the Applies To list.

Note  If you set this property to wdAlertsNone or wdAlertsMessageBox, Word doesn't set it back to wdAlertsAll when your macro stops running. You should write your macro in such a way that it always sets the DisplayAlerts property back to wdAlertsAll when it stops running.

Example

This example sets Word to display all alerts and message boxes when it's running macros.

Application.DisplayAlerts = wdAlertsAll

This example returns the current setting of the DisplayAlerts property.

Dim lngTemp As Long

lngTemp = Application.DisplayAlerts

Applies to | Application Object

See Also | FeatureInstall Property