Document.MailMergeWizardSendToCustom Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the custom button is clicked on step six of the Mail Merge Wizard.
public:
event EventHandler ^ MailMergeWizardSendToCustom;
event EventHandler MailMergeWizardSendToCustom;
member this.MailMergeWizardSendToCustom : EventHandler
Event MailMergeWizardSendToCustom As EventHandler
Event Type
Examples
The following code example executes a merge when you click the custom destination button. This example assumes that you have access to a custom destination button. This example is for an application-level add-in.
private void DocumentMailMergeWizardSendToCustom()
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.MailMergeWizardSendToCustom += new
EventHandler(ThisDocument_MailMergeWizardSendToCustom);
}
void ThisDocument_MailMergeWizardSendToCustom(object sender, EventArgs e)
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.MailMerge.ShowSendToCustom = "Custom Destination";
vstoDoc.MailMerge.Destination = Microsoft.Office.Interop
.Word.WdMailMergeDestination.wdSendToNewDocument;
vstoDoc.MailMerge.Execute(ref missing);
}
Private Sub DocumentMailMergeWizardSendToCustom()
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
AddHandler vstoDoc.MailMergeWizardSendToCustom, AddressOf ThisDocument_MailMergeWizardSendToCustom
End Sub
Private Sub ThisDocument_MailMergeWizardSendToCustom(ByVal sender As Object, ByVal e As EventArgs)
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
vstoDoc.MailMerge.ShowSendToCustom = "Custom Destination"
vstoDoc.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestination. _
wdSendToNewDocument
vstoDoc.MailMerge.Execute()
End Sub
Remarks
Use the ShowSendToCustom property to create a custom button on the sixth step of the Mail Merge Wizard.