MailMergeFields.AddMergeRec Method

Word Developer Reference

Adds a MERGEREC field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression.AddMergeRec(Range)

expression   Required. A variable that represents a MailMergeFields collection.

Parameters

Name Required/Optional Data Type Description
Range Required Range object The location for the MERGEREC field.

Return Value
MailMergeField

Remarks

A MERGEREC field inserts the number of the current record (the position of the record in the current query result) during a mail merge.

Example

This example inserts text and a MERGEREC field at the beginning of the active document.

Visual Basic for Applications
  Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)

ActiveDocument.MailMerge.Fields.AddMergeRec Range:=rngTemp rngTemp.InsertAfter "Record Number: "

See Also