DisplayAlerts Property

Applies To

Application object.

Description

Returns or sets the way certain alerts and messages are handled while a macro is running. Read/write Long.

Can be one of the following WdAlertLevel constants.

Constant

Description

wdAlertsNone

No alerts or message boxes are displayed. If a macro encounters a message box, the default value is chosen and the macro continues.

wdAlertsMessageBox

Only message boxes are displayed; errors are trapped and returned to the macro.

wdAlertsAll

All message boxes and alerts are displayed; errors are returned to the macro.


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.

temp = Application.DisplayAlerts