AddSet Method Example

This example adds a SET field at the beginning of the active document and then adds a REF field to display the text after the selection.

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