Document.MailMergeWizardSendToCustom Event (2007 System)
Occurs when the custom button is clicked on step six of the Mail Merge Wizard.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Event MailMergeWizardSendToCustom As EventHandler
'Usage
Dim instance As Document
Dim handler As EventHandler
AddHandler instance.MailMergeWizardSendToCustom, handler
public event EventHandler MailMergeWizardSendToCustom
public:
event EventHandler^ MailMergeWizardSendToCustom {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
JScript does not support events.
Remarks
Use the ShowSendToCustom property to create a custom button on the sixth step of the Mail Merge Wizard.
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 version is for a document-level customization.
Private Sub DocumentMailMergeWizardSendToCustom()
AddHandler Me.MailMergeWizardSendToCustom, AddressOf ThisDocument_MailMergeWizardSendToCustom
End Sub
Private Sub ThisDocument_MailMergeWizardSendToCustom(ByVal sender As Object, ByVal e As EventArgs)
Me.MailMerge.ShowSendToCustom = "Custom Destination"
Me.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestination. _
wdSendToNewDocument
Me.MailMerge.Execute()
End Sub
private void DocumentMailMergeWizardSendToCustom()
{
this.MailMergeWizardSendToCustom += new
EventHandler(ThisDocument_MailMergeWizardSendToCustom);
}
void ThisDocument_MailMergeWizardSendToCustom(object sender, EventArgs e)
{
this.MailMerge.ShowSendToCustom = "Custom Destination";
this.MailMerge.Destination = Microsoft.Office.Interop
.Word.WdMailMergeDestination.wdSendToNewDocument;
this.MailMerge.Execute(ref missing);
}
This version is for an application-level add-in.
Private Sub DocumentMailMergeWizardSendToCustom()
Dim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
AddHandler vstoDoc.MailMergeWizardSendToCustom, AddressOf ThisDocument_MailMergeWizardSendToCustom
End Sub
Private Sub ThisDocument_MailMergeWizardSendToCustom(ByVal sender As Object, ByVal e As EventArgs)
Dim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
vstoDoc.MailMerge.ShowSendToCustom = "Custom Destination"
vstoDoc.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestination. _
wdSendToNewDocument
vstoDoc.MailMerge.Execute()
End Sub
private void DocumentMailMergeWizardSendToCustom()
{
Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
vstoDoc.MailMergeWizardSendToCustom += new
EventHandler(ThisDocument_MailMergeWizardSendToCustom);
}
void ThisDocument_MailMergeWizardSendToCustom(object sender, EventArgs e)
{
Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
vstoDoc.MailMerge.ShowSendToCustom = "Custom Destination";
vstoDoc.MailMerge.Destination = Microsoft.Office.Interop
.Word.WdMailMergeDestination.wdSendToNewDocument;
vstoDoc.MailMerge.Execute(ref missing);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Word Namespace
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Added a version of the code example for an application-level add-in. |
SP1 feature change. |