DataFieldIndex Property

Microsoft Word Visual Basic

Show All

DataFieldIndex Property

       

Returns or sets a Long that represents the corresponding field number in the mail merge data source to which a mapped data field maps. This property returns zero if the specified data field is not mapped to a mapped data field. Read/write.

expression.DataFieldIndex

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

This example maps the PostalAddress1 field in the data source to the wdAddress1 mapped data field. This example assumes that the current document is a mail merge document.

Sub MapField()
    With ThisDocument.MailMerge.DataSource
        .MappedDataFields(wdAddress1).DataFieldIndex = _
            .FieldNames("PostalAddress1").Index
    End With
End Sub