Share via


DocumentBase.MailMergeDataSourceLoad Event

Occurs when the data source is loaded for a mail merge.

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

Syntax

'Declaration
Public Event MailMergeDataSourceLoad As EventHandler
public event EventHandler MailMergeDataSourceLoad

Examples

The following example displays a message when the data source for a mail merge is loaded. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentMailMergeDataSourceLoad()
    AddHandler Me.MailMergeDataSourceLoad, AddressOf ThisDocument_MailMergeDataSourceLoad
End Sub 

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

void ThisDocument_MailMergeDataSourceLoad(object sender, EventArgs e)
{
    object index = 1;
    MessageBox.Show(this.MailMerge.DataSource.DataFields.get_Item(ref index).Value
         + " is loading.");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace