Share via


Document.MailMergeDataSourceLoad-Ereignis

Wird ausgelöst, wenn die Datenquelle für einen Seriendruck geladen wird.

Namespace:  Microsoft.Office.Tools.Word
Assemblys:   Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Event MailMergeDataSourceLoad As EventHandler
event EventHandler MailMergeDataSourceLoad

Beispiele

Im folgenden Beispiel wird eine Meldung angezeigt, wenn die Datenquelle für einen Seriendruck geladen wird.Dieses Beispiel bezieht sich auf ein Add-In auf Anwendungsebene.

Private Sub DocumentMailMergeDataSourceLoad()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeDataSourceLoad, AddressOf ThisDocument_MailMergeDataSourceLoad
End Sub

Private Sub ThisDocument_MailMergeDataSourceLoad(ByVal sender As Object, ByVal e As EventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    Dim index As Object = 1
    System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.Item(index).Value & _
        " is loading.")
End Sub
private void DocumentMailMergeDataSourceLoad()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeDataSourceLoad += new EventHandler(ThisDocument_MailMergeDataSourceLoad);
}

void ThisDocument_MailMergeDataSourceLoad(object sender, EventArgs e)
{
    object index = 1;
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.get_Item(ref index).Value
         + " is loading.");
}

.NET Framework-Sicherheit

Siehe auch

Referenz

Document Schnittstelle

Microsoft.Office.Tools.Word-Namespace