Class MappedDataFields (Word VBA)
A collection of MappedDataField objects that represents all the mapped data fields available in Microsoft Word. To use a MappedDataFields class variable it first needs to be instantiated, for example
Dim mdfs as MappedDataFields
Set mdfs = ActiveDocument.MailMerge.DataSource.MappedDataFields
For Each
Here is an example of processing the MappedDataFields items in a collection.
Dim mdf As MappedDataField
For Each mdf In ActiveDocument.MailMerge.DataSource.MappedDataFields
Next mdf
Count
Returns a Long that represents the number of mapped data fields in the collection.
Dim lngCount As Long
lngCount = ActiveDocument.MailMerge.DataSource.MappedDataFields.Count
Item
Returns an individual MappedDataField object.
Item (Index)
Index: The specified mapped data field.
Dim mdf As MappedDataField
Set mdf = ActiveDocument.MailMerge.DataSource.MappedDataFields(Index:=1)