FormFieldOptions

Syntax

FormFieldOptions [.Entry = text] [, .Exit = text] [, .Name = text] [, .Enable = number] [, .TextType = number] [, .TextWidth = number or text] [, .TextDefault = text] [, .TextFormat = text] [, .CheckSize = number] [, .CheckWidth = number or text] [, .CheckDefault = number] [, .Type = number] [, .OwnHelp = number] [, .HelpText = text] [, .OwnStat = number] [, .StatText = text]

Remarks

Changes the properties of a selected form field. The arguments for the FormFieldOptions statement correspond to the options in the dialog box that Word displays when you select a form field and click the Form Field Options button on the Forms toolbar or choose Form Field Options from the shortcut menu. If more than one form field is selected, FormFieldOptions changes the properties of the first form field in the selection. If no form field is selected, or if you attempt to set options that are inappropriate for the selected form field, an error occurs.

Argument

Explanation

.Entry

The macro that runs when the form field receives the focus

.Exit

The macro that runs when the form field loses the focus

.Name

The name of the bookmark that will mark the form field

.Enable

If 1, allows the form field to be changed as the form is filled in

.TextType

For a text form field, specifies the type:

0 (zero) Regular Text

1 Number

2 Date

3 Current Date

4 Current Time

5 Calculation

.TextWidth

For a text form field, specifies a maximum width:

0 (zero) Unlimited

> 0 A maximum width, in characters

.TextDefault

The default text for a text form field

.TextFormat

For a text form field, specifies a format appropriate for .TextType. If .TextType is set to 0 (zero) for Regular Text, the following values are available: Uppercase, Lowercase, First Capital, Title Case. For formats available to other text types, review the items in the Text Format box in the Text Form Field Options dialog box.

.CheckSize

For a check box form field, specifies whether to set a fixed size:

0 (zero) Auto (the size is determined by the font size of the surrounding text).

1 Exactly (the size is fixed to that specified by .CheckWidth).

.CheckWidth

For a check box form field, and if .CheckSize is set to 1, specifies
a fixed width and height in points or a text measurement.

.CheckDefault

For a check box form field, specifies whether the check box should be cleared or selected by default:

0 (zero) Cleared

1 Selected


Argument

Explanation

.Type

Specifies the type of form field:

0 (zero) or omitted Text form field

1 Check box form field

2 Drop-down form field

.OwnHelp

If 1, allows .HelpText to be specified.

.HelpText

The text that is displayed in a message box when the form field has the focus and the user presses F1 (Windows) or COMMAND+/ or HELP (Macintosh).

.OwnStat

If 1, allows .StatText to be specified.

.StatText

The text that is displayed in the status bar when the form field has the focus.


You can use the FormFieldOptions dialog record to retrieve information about the selected form field. For details, see the second example in this entry.

Examples

This example specifies help text for the selected form field. Help text is specified for both the status bar and the box that Word displays when the user presses F1 (Windows) or COMMAND+/ or HELP (Macintosh).


FormFieldOptions .OwnHelp = 1, .HelpText = "Briefly summarize " + \
    "your favorite activity. Provide specific details.", \
    .OwnStat = 1, .StatText = "What you like to do best..."

This example uses the FormFieldOptions dialog record to define the variable curType with a number that corresponds to the .Type setting for the selected form field. You can use this example as a model for how to return information on any of the options you can set with FormFieldOptions.


Dim dlg As FormFieldOptions
GetCurValues dlg
curType = dlg.Type

See Also

EnableFormField, InsertFormField