共用方式為


Document.MailMergeWizardSendToCustom 事件

當在 [合併列印精靈] 的步驟六按一下自訂按鈕時發生。

命名空間:  Microsoft.Office.Tools.Word
組件:  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 命名空間