Class MailMergeDataFields (Word VBA)

A collection of MailMergeDataField objects that represent the data fields in a mail merge data source. To use a MailMergeDataFields class variable it first needs to be instantiated, for example


Dim mmds as MailMergeDataFields
Set mmds = ActiveDocument.MailMerge.DataSource.DataFields

Count

Returns a Long that represents the number of mail merge data fields in the collection.


Dim lngCount As Long
lngCount = ActiveDocument.MailMerge.DataSource.DataFields.Count

Item

Returns an individual MailMergeDataField object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.


Dim mmd As MailMergeDataField
Set mmd = ActiveDocument.MailMerge.DataSource.DataFields(Index:=1)