FormFields (collection)

<< Click to Display Table of Contents >>

FormFields (collection)

Access paths:

Application à Documents à Item à FormFields

Application à ActiveDocument à FormFields

 1  Description

FormFields is a collection of all form objects (text fields, check boxes and drop-down lists) in a document. The individual elements of this collection are of the type FormField.

 2  Access to the collection

Each open document has exactly one instance of the FormFields collection. It is accessed through Document.FormFields:

' Display the number of form fields in the active document

MsgBox tm.ActiveDocument.FormFields.Count

 3  Properties, objects, collections and methods

Properties:

Count R/O

DisplayFieldNames

Shaded

Objects:

Item FormField (default object)

Application Application

Parent Document

Count (property, R/O)

Data type: Long

Returns the number of FormField objects in the document – in other words: the number of form objects in the document.

DisplayFieldNames (property)

Data type: Boolean

Gets or sets the setting "Display field names" in the respective document (True or False).

Shaded (property)

Data type: Boolean

Gets or sets the setting "Shade fields" in the respective document (True or False).

Item (pointer to object)

Data type: Object

Returns an individual FormField object, i.e. an individual form object.

Which FormField object you get depends on the parameter that you pass to Item. You can specify either the numeric index or the name of the desired form object. Examples:

' Show the numeric type of the first form field in the document

MsgBox tm.ActiveDocument.FormFields(1).Type

 

' Show the numeric type of the form field named "DropDown1"

MsgBox tm.ActiveDocument.FormFields("DropDown1").Type

Application (pointer to object)

Data type: Object

Returns the Application object.

Parent (pointer to object)

Data type: Object

Returns the parent object, i.e. an object of the type Document.