MailMergeFields.AddSet (Word)

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

A SET field defines the text of the specified bookmark.

AddSet (Range, Name, ValueText, ValueAutoText)


Dim rngTemp as Range 
 
Set rngTemp = ActiveDocument.Range(Start:=0, End:=0) 
 
ActiveDocument.MailMerge.Fields.AddSet Range:=rngTemp, _ 
 Name:="Name", ValueText:="Joe Smith" 
Selection.Collapse Direction:=wdCollapseEnd 
ActiveDocument.Fields.Add Range:=Selection.Range, _ 
 Type:=wdFieldRef, Text:="Name"

Arguments

The following arguments are required:

Range (Range) - The location for the SET field.

Name (String) - The bookmark name that ValueText is assigned to.

Optional arguments

The following arguments are optional

ValueText (String) - The text associated with the bookmark specified by the Name argument.

ValueAutoText (String) - The AutoText entry that includes text associated with the bookmark specified by the Name argument. If this argument is specified, ValueText is ignored.