Document.MailMergeBeforeMerge 이벤트

병합이 실행될 경우 레코드가 병합되기 전에 발생합니다.

네임스페이스:  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 MailMergeBeforeMerge As EventHandler
event EventHandler MailMergeBeforeMerge

설명

편지 병합 프로세스를 중지하려면 제공된 CancelEventArgs의 Cancel 인수를 true로 설정합니다.

예제

다음 코드 예제에서는 수동 편지 병합이 실행되기 전에 메시지를 표시합니다.이 예제는 응용 프로그램 수준 추가 기능을 위한 것입니다.

Private Sub DocumentMailMergeBeforeMerge()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeBeforeMerge, AddressOf ThisDocument_MailMergeBeforeMerge
End Sub

Private Sub ThisDocument_MailMergeBeforeMerge(ByVal sender As Object, ByVal e As EventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    System.Windows.Forms.MessageBox.Show("Your mail merge on " & vstoDoc.Name & " is now starting.")
End Sub
private void DocumentMailMergeBeforeMerge()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeBeforeMerge += new EventHandler(ThisDocument_MailMergeBeforeMerge);
}

void ThisDocument_MailMergeBeforeMerge(object sender, EventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show("Your mail merge on "
        + vstoDoc.Name + " is now starting.");
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Document 인터페이스

Microsoft.Office.Tools.Word 네임스페이스