DataFields Property

Applies To

MailMergeDataSource object.

Description

Returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source. Read-only.

See Also

Name property, Value property.

Example

This example displays the name of each field in the data source attached to the active mail merge main document.

For Each mField In ActiveDocument.MailMerge.DataSource.DataFields
    MsgBox mField.Name
Next mField
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