Evento Document.MailMergeBeforeMerge

Viene generato all'esecuzione di un'unione, prima dell'unione dei record.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Sintassi

'Dichiarazione
Event MailMergeBeforeMerge As EventHandler
event EventHandler MailMergeBeforeMerge

Note

Per interrompere il processo di stampa unione, impostare l'argomento Cancel dell'oggetto CancelEventArgs fornito su true.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come visualizzare un messaggio prima dell'esecuzione di qualsiasi stampa unione manuale. Questo esempio è valido per un componente aggiuntivo a livello di applicazione.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Document Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Word