

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. Word Object Model Reference Support and feedback Range:=ActiveDocument.Range(Start:=0, End:=0), _ The following example adds a text form field at the beginning of the active document and then sets the name of the form field to "FirstName." Set ffield = ( _ Use the Add method with the FormFields object to add a text form field. Set ffield = ActiveDocument.FormFields(1).TextInput

The following example determines whether the ffield variable represents a valid text form field in the active document before it sets the default text. If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput ThenĪctiveDocument.FormFields(1).Result = "Mission Critical" If the form field is a text form field, the example sets "Mission Critical" as the value of the field. To add the first field, complete the following steps in the Word form: Display the Forms toolbar by choosing Toolbars from the View menu and selecting Forms. The following example checks the type of the first form field in the active document. The index number represents the position of the form field in the FormFields collection. ActiveDocument.FormFields("Text1").TextInput.Clear The following example deletes the contents of the text form field named "Text1" in the active document. Use the TextInput property with the FormField object to return a TextInput object. Use FormFields (Index), where Index is either the bookmark name associated with the text form field or the index number, to return a FormField object.
