MainDocumentType Property

Microsoft Word Visual Basic

Show All

MainDocumentType Property

       

Returns or sets the mail merge main document type. Read/write WdMailMergeMainDocType.

WdMailMergeMainDocType can be one of these WdMailMergeMainDocType constants.
wdCatalog
wdDirectory
wdEMail
wdEnvelopes
wdFax
wdFormLetters
wdMailingLabels
wdNotAMergeDocument

expression.MainDocumentType

expression   Required. An expression that returns a MailMerge object.

Remarks

If you set this property for a document that's already a main document, the attached data source is removed.

Example

This example creates a new document and makes it a catalog main document for a mail merge operation.

Set myDoc = Documents.Add
myDoc.MailMerge.MainDocumentType = wdCatalog

This example determines whether the active document is a main document for a mail merge operation, and then it displays a message in the status bar.

Set doc = ActiveDocument
If doc.MailMerge.MainDocumentType = wdNotAMergeDocument Then
    StatusBar = "Not a mail merge main document"
Else
    StatusBar = "Document is a mail merge main document."
End If