Execute Method (Dialog, KeyBinding, and MailMerge Objects)
Applies To
Dialog object, KeyBinding object, MailMerge object.
Description
Dialog object: Applies the current settings of a Word dialog box.
KeyBinding object: Runs the command associated with the specified key combination.
MailMerge object: Performs the specified mail merge operation.
Syntax 1
expression.Execute(Pause)
Syntax 2
expression.Execute
expression Required. An expression that returns a MailMerge object (Syntax 1), or a Dialog object or KeyBinding object (Syntax 2).
Pause Optional Variant. True to have Word pause and display a troubleshooting dialog box if a mail merge error is found. False to report errors in a new document.
See Also
Display method, FindKey property, MailMerge property, Show method.
Example
The following example enables the Keep with next check box on the Line and Page Breaks tab in the Paragraph dialog box.
With Dialogs(wdDialogFormatParagraph)
.KeepWithNext = 1
.Execute
End With
This example assigns the CTRL+SHIFT+C key combination to the FileClose command and then executes the key combination (the document is closed).
CustomizationContext = ActiveDocument.AttachedTemplate
Keybindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyC), _
KeyCategory:=wdKeyCategoryCommand, Command:="FileClose"
FindKey(BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyC)).Execute
This example executes a mail merge if the active document is a main document with an attached data source.
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndDataSource Then MyMerge.Execute