Expand Minimize
1 out of 2 rated this helpful - Rate this topic

Document.MailMerge Property

Gets a MailMerge that represents the mail merge functionality for the document.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public virtual MailMerge MailMerge { get; }

Property Value

A MailMerge that represents the mail merge functionality for the document.

The MailMerge object is available regardless of whether the specified document is a mail merge main document. Use the State property to determine the current state of the mail merge operation.

The following code example opens a data source and then merges the document with the data source. This code assumes that you have a data source called test.mdb saved at the root of the C directory.

private void DocumentMailMerge()
{
    this.MailMerge.OpenDataSource("C:\\test.mdb",
        ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing);
        this.MailMerge.Execute(ref missing);
}

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.