Application.MailMergeBeforeMerge Event
Word Developer Reference |
Occurs when a merge is executed before any records merge.
Syntax
expression.Private Sub object_MailMergeBeforeMerge(ByVal Doc As Document, ByVal StartRecord As Long, ByVal EndRecord As Long, Cancel As Boolean)
expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Doc | Required | Document | The mail merge main document. |
StartRecord | Required | Long | The first record in the data source to include in the mail merge. |
EndRecord | Required | Long | The last record in the data source to include in the mail merge. |
EndRecord | Required | Boolean | True stops the mail merge process before it starts. |
Example
This example displays a message before the mail merge process begins, asking the user if they want to continue. If the user clicks No, the merge process is canceled. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Microsoft Office Word Application object.
Visual Basic for Applications |
---|
|
See Also