Skip to content

Latest commit

 

History

History
64 lines (35 loc) · 1.33 KB

Word.MailMergeFields.AddMergeRec.md

File metadata and controls

64 lines (35 loc) · 1.33 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
MailMergeFields.AddMergeRec method (Word)
vbawd10.chm153026665
vbawd10.chm153026665
Word.MailMergeFields.AddMergeRec
50146076-696e-9a78-5e58-4ecb0f32607f
06/08/2017
medium

MailMergeFields.AddMergeRec method (Word)

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.

Dim rngTemp As Range 
 
Set rngTemp = ActiveDocument.Range(Start:=0, End:=0) 
 
ActiveDocument.MailMerge.Fields.AddMergeRec Range:=rngTemp 
rngTemp.InsertAfter "Record Number: "

See also

MailMergeFields Collection Object

[!includeSupport and feedback]