FormFields Property

Applies To

Document object, Range object, Selection object.

Description

Returns a FormFields collection that represents all the form fields in the document, range, or selection. Read-only.

See Also

CheckBox property, DropDown property, Result property, TextInput property.

Example

This example sets the content of the form field named "Text1" to "Name."

ActiveDocument.FormFields("Text1").Result = "Name"
This example retrieves the type of the first form field in section two.

myType = ActiveDocument.Sections(2).Range.FormFields(1).Type
Select Case myType
    Case wdFieldFormTextInput
        thetype = "TextBox"
    Case wdFieldFormDropDown
        thetype = "DropDown"
    Case wdFieldFormCheckBox
        thetype = "CheckBox"
End Select
This example displays the name of the first form field in the selection.

If Selection.FormFields.Count > 0 Then
    MsgBox Selection.FormFields(1).Name
End If