Share via


MailMergeFields.Add Method (Word)

Returns a MailMergeField object that represents a mail merge field added to the data source document.

Syntax

expression .Add(Range, Name)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name

Required/Optional

Data Type

Description

Range

Required

Range

The range where you want the field to appear. This field replaces the range, if the range isn't collapsed.

Name

Required

String

The name of the field.

Return Value

MailMergeField

Example

This example replaces the selection with a mail merge field named MiddleInitial.

ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, _ 
 Name:="MiddleInitial"

See Also

Concepts

MailMergeFields Collection Object

MailMergeFields Object Members