MergeFieldName$()

Syntax

MergeFieldName$(Count)

Remarks

Returns a field name in a data source or header source. In a data source set up as
a Word table, the field names are in the first row as column headings. In a data source set up as delimited lists, the field names are in the first paragraph. An error occurs if you run MergeFieldName$() when the active document is not a main document.

Argument

Explanation

Count

The number corresponding to the field name in the data source or header source, where 1 is the first field name, 2 is the second, and
so on.


Example

This example defines an array containing the field names available to a main document (which must be active when the example is run):


numFields = CountMergeFields()
Dim mmFields$(numFields - 1)
For count = 1 To numFields
    mmFields$(count - 1) = MergeFieldName$(count)
Next count

See Also

CountMergeFields(), InsertMergeField