MailMergeFields.AddMergeSeq Method

Word Developer Reference

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

Syntax

expression.AddMergeSeq(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 MERGESEQ field.

Return Value
MailMergeField

Remarks

A MERGESEQ field inserts a number based on the sequence in which records are merged (for example, when record 50 of records 50 to 100 is merged, MERGESEQ inserts the number 1).

Example

This example inserts text and a MERGESEQ field at the end of the active document.

Visual Basic for Applications
  Dim rngTemp As Range

Set rngTemp = ActiveDocument.Content

rngTemp.Collapse Direction:=wdCollapseEnd ActiveDocument.MailMerge.Fields.AddMergeSeq Range:=rngTemp rngTemp.InsertAfter "Sequence Number: "

See Also