TextInput 属性

       

该属性返回一个 TextInput 对象,该对象代表一个文字型窗体域。

expression.TextInput

expression   必需。该表达式返回一个 FormField 对象。

说明

如果将 TextInput 属性应用于非下拉型窗体域的 FormField 对象,则虽然该属性不会失效,但所返回对象的 Valid 属性值将为 False

使用 FormField 对象的 Result 属性可返回或设置 TextInput 对象的内容,如下所示:

ActiveDocument.FormFields("Text1").Result = "John Doe"

示例

本示例保护活动文档的窗体,并删除名为“Text1”的窗体域的内容。

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

如果活动文档中的第一个窗体域是一个接受常规文本的文字型窗体域,则本示例设置该窗体域的内容。

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