Document.MailMergeWizardSendToCustom 事件

在**“邮件合并向导”**的第六步中单击自定义按钮时发生。

命名空间:  Microsoft.Office.Tools.Word
程序集:   Microsoft.Office.Tools.Word.v4.0.Utilities(在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
  Microsoft.Office.Tools.Word(在 Microsoft.Office.Tools.Word.dll 中)

语法

声明
Event MailMergeWizardSendToCustom As EventHandler
event EventHandler MailMergeWizardSendToCustom

备注

使用 ShowSendToCustom 属性在**“邮件合并向导”**的第六步中创建自定义按钮。

示例

下面的代码示例在您单击自定义目标按钮时执行合并。此示例假定您对自定义目标按钮拥有访问权限。此示例针对的是应用程序级外接程序。

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
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);
}

.NET Framework 安全性

请参见

参考

Document 接口

Microsoft.Office.Tools.Word 命名空间