FormField.TextInput property (Word)

Returns a TextInput object that represents a text form field.

Syntax

expression. TextInput

expression An expression that returns a 'FormField' object.

Remarks

If the TextInput property is applied to a FormField object that isn't a drop-down form field, the property won't fail, but the Valid property for the returned object will be False.

Use the Result property with the FormField object to return or set the contents of a TextInput object, as follows:

Example

This example protects the active document for forms and deletes the contents of the form field named "Text1."

ActiveDocument.Protect Type:=wdAllowOnlyFormFields 
ActiveDocument.FormFields("Text1").TextInput.Clear

If the first form field in the active document is a text form field that accepts regular text, this example sets the contents of the form field.

Set myField = ActiveDocument.FormFields(1) 
If myField.Type = wdFieldFormTextInput And _ 
 myField.TextInput.Type = wdRegularText Then 
 myField.Result = "Hello" 
End If

See also

FormField Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.