Share via


FormFields.Add Method (Word)

Returns a FormField object that represents a new form field added at a range.

Syntax

expression .Add(Range, Type)

expression Required. A variable that represents a FormFields collection.

Parameters

Name

Required/Optional

Data Type

Description

Range

Required

Range object

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

Type

Required

WdFieldType

The type of form field to add.

Return Value

FormField

Remarks

Security noteSecurity Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

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

See Also

Concepts

FormFields Object Members

FormFields Collection Object