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

MailMergeFields Collection Object

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.