MailMergeDataSource.DataFields property (Word)
Returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source. Read-only.
expression A variable that represents a 'MailMergeDataSource' object.
For information about returning a single member of a collection, see Returning an object from a collection.
This example displays the name of each field in the data source attached to the active mail merge main document.
Dim mmdfTemp As MailMergeDataField For Each mmdfTemp In _ ActiveDocument.MailMerge.DataSource.DataFields MsgBox mmdfTemp.Name Next mmdfTemp
This example displays the value of the LastName field from the first record in the data source attached to "Main.doc."
With Documents("Main.doc").MailMerge.DataSource .ActiveRecord = wdFirstRecord MsgBox .DataFields("LastName").Value End With
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.