MailMergeFields.AddMergeRec method (Word)
Adds a MERGEREC field to a mail merge main document. Returns a MailMergeField object.
expression Required. A variable that represents a 'MailMergeFields' collection.
|Range||Required||Range object||The location for the MERGEREC field.|
A MERGEREC field inserts the number of the current record (the position of the record in the current query result) during a mail merge.
This example inserts text and a MERGEREC field at the beginning of the active document.
Dim rngTemp As Range Set rngTemp = ActiveDocument.Range(Start:=0, End:=0) ActiveDocument.MailMerge.Fields.AddMergeRec Range:=rngTemp rngTemp.InsertAfter "Record Number: "
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.