Class MailMergeDataSource (Word VBA)

The class MailMergeDataSource represents the mail merge data source in a mail merge operation.

Class MailMerge gives access to class MailMergeDataSource.


Dim mmd as MailMergeDataSource
Set mmd = ActiveDocument.MailMerge.DataSource

Methods

Close - Closes the specified Mail Merge data source.

FindRecord - Searches the contents of the specified mail merge data source for text in a particular field. Returns True if the search text is found.

SetAllErrorFlags - Marks all records in a mail merge data source as containing invalid data in an address field.

SetAllIncludedFlags - Includes or excludes flagged records in a data source from a mail merge.

Properties

ActiveRecord returns or sets the active mail merge record. Can be either a valid record number in the query result or one of the WdMailMergeActiveRecord constants.

ConnectString returns the connection string for the specified mail merge data source.

DataFields returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source.

FieldNames returns a MailMergeFieldNames collection that represents the names of all the fields in the specified mail merge data source.

FirstRecord returns or sets the number of the first record to be merged in a mail merge operation.

HeaderSourceName returns the path and file name of the header source attached to the specified mail merge main document.

HeaderSourceType returns a value that indicates the way the header source is being supplied for the mail merge operation.

Included true if a record is included in a mail merge.

InvalidAddress true for Microsoft Word to mark a record in a mail merge data source if it contains invalid data in an address field.

InvalidComments if the InvalidAddress property is True, returns or sets a String that describes an invalid address error.

LastRecord returns or sets the number of the last record to be merged in a mail merge operation.

MappedDataFields returns a MappedDataFields collection that represents the mapped data fields available in Microsoft Word.

Name returns name of the specified object.

QueryString returns or sets the query string (SQL statement) used to retrieve a subset of the data in a mail merge data source.

RecordCount returns a Long that represents the number of records in the data source.

TableName returns a String with the SQL query used to retrieve the records from the data source file attached to a mail merge document.

Type returns the type of mail merge data source.

MailMergeDataFields - A collection of MailMergeDataField objects that represent the data fields in a mail merge data source.

MailMergeFieldNames - Word Object Model Reference

MappedDataFields - A collection of MappedDataField objects that represents all the mapped data fields available in Microsoft Word.