Document.MailMerge Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property MailMerge As MailMerge
'Usage
Dim instance As Document 
Dim value As MailMerge 

value = instance.MailMerge
[BrowsableAttribute(false)]
public MailMerge MailMerge { get; }
[BrowsableAttribute(false)]
public:
property MailMerge^ MailMerge {
    MailMerge^ get ();
}
public function get MailMerge () : MailMerge

Property Value

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

Remarks

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.

Examples

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.

This example is for a document-level customization.

Private Sub DocumentMailMerge()
    Me.MailMerge.OpenDataSource("C:\test.mdb")
    Me.MailMerge.Execute()
End Sub
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);
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace