Share via


DocumentBase.MailMergeWizardSendToCustom 事件

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

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

'宣告
Public Event MailMergeWizardSendToCustom As EventHandler
public event EventHandler MailMergeWizardSendToCustom

備註

使用 ShowSendToCustom 屬性在 [合併列印精靈] 的步驟六建立自訂按鈕。

範例

下列程式碼範例會在按一下自訂目的按鈕時執行合併。 此範例假設您具有自訂目的按鈕的存取權。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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

.NET Framework 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間