Search notes:

Office Object Model: Word - MailMerge

Each document has a MailMerge object which can be accessed via the document.mailMerge property. This MailMerge object is present whether or not the document is set up for a mail merge operation (see state property).

state

The read-only property state returns a value of the wdMailMergeState enumeration which is one of
wdNormalDocument 0 The document is not used for mail merge
wdMainDocumentOnly 1 Data for mail merge is not attached (data source not specified?)
wdMainAndDataSource 2 Document has an attached data source
wdMainAndHeader 3 Document has an attached data source for the header
wdMainAndSourceAndHeader 4 Combination of wdMainAndDataSource and wdMainAndHeader?
wdDataSource 5 Data source without main document

dataSource

dataSource returns an instance whose type is MailMergeDataSource

execute

execute creates the document(s) with the filled in values.
It only makes sense to call execute if there is an attached MailMergeDataSource. This can be verified with
if activeDocument.mailMerge.state > wdMainDocumentOnly then
   activeDocument.mailMerge.execute
end if

mainDocumentType

wdCatalog 3
wdDirectory 3
wdEMail 4
wdEnvelopes 2
wdFax 5
wdFormLetters 0
wdMailingLabels 1
wdNotAMergeDocument -1

See also

DAta from an Access database can be exported for a mail merge under the menu External Data -> Export.
Word Object Model

Index