Add Method (FormFields Collection)

Applies To

FormFields collection object.

Description

Adds a new form field at the specified range.

Syntax

expression.Add(Range, Type)

expression Required. An expression that returns a FormFields object.

Range Required Range. The range where you want to add the form field. If the range isn't collapsed, the form field replaces the range.

Type Required Long. The type of form field to add. Can be one of the following WdFieldType constants: wdFieldFormCheckBox, wdFieldFormDropDown, or wdFieldFormTextInput.

See Also

Add method (ListEntries collection), CheckBox property, DropDown property, TextInput property.

Example

This example adds a check box at the end of the selection, gives it a name, and then selects it.

Selection.Collapse Direction:=wdCollapseEnd
Set ffield = ActiveDocument.FormFields.Add(Range:=Selection.Range, _
    Type:=wdFieldFormCheckBox)
With ffield
    .Name = "Check_Box_1"
    .CheckBox.Value = True
End With