Document.MailMergeWizardSendToCustom 事件

定義

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

event EventHandler MailMergeWizardSendToCustom;

事件類型

EventHandler

範例

當您按一下 [自訂目的地] 按鈕時,下列程式碼範例會執行合併。 這個範例假設您具有自訂目的地按鈕的存取權。 這個範例適用于應用層級增益集。

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

備註

使用 ShowSendToCustom 屬性,即可在 [合併列印] 嚮導的第六個步驟上建立自訂按鈕。

適用於