FormField.ExitMacro property (Word)

Returns or sets an exit macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.

Syntax

expression. ExitMacro

expression A variable that represents a 'FormField' object.

Remarks

The exit macro runs when the form field loses the focus.

Example

This example assigns the macro named "Reformat" to the first form field in the selection.

If Selection.FormFields.Count > 0 Then _ 
 Selection.FormFields(1).ExitMacro = "Reformat"

This example assigns the macro named "Blue" to the last form field in "Form.doc."

Dim intMax As Integer 
 
intMax = Documents("Form.doc").FormFields.Count 
Documents("Form.doc").FormFields(intMax).ExitMacro = "Blue"

See also

FormField Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.