EditType Method

Microsoft Word Visual Basic

EditType Method

       

Sets options for the specified text form field.

expression.EditType(Type, Default, Format, Enabled)

expression   Required. An expression that returns a TextInput object.

Type  Required WdTextFormFieldType. The text box type.

WdTextFormFieldType can be one of these WdTextFormFieldType constants.
wdCalculationText
wdCurrentDateText
wdCurrentTimeText
wdDateText
wdNumberText
wdRegularText

Default   Optional Variant. The default text that appears in the text box.

Format   Optional Variant. The formatting string used to format the text, number, or date (for example, "0.00," "Title Case," or "M/d/yy"). For more examples of formats, see the list of formats for the specified text form field type in the Text Form Field Options dialog box.

Enabled   Optional Variant. True to enable the form field for text entry.

Example

This example adds a text form field named "Today" at the beginning of the active document. The EditType method is used to set the type to wdCurrentDateText and set the date format to "M/d/yy."

With ActiveDocument.FormFields.Add _
        (Range:=ActiveDocument.Range(0, 0), _
        Type:=wdFieldFormTextInput)
    .Name = "Today"
    .TextInput.EditType Type:=wdCurrentDateText, _
        Format:="M/d/yy", Enabled:=False
End With