GetFormResult(), GetFormResult$()

Syntax

GetFormResult(BookmarkName$)

GetFormResult$(BookmarkName$)

Remarks

GetFormResult() returns a number corresponding to the setting of a check box form field or drop-down form field marked by the bookmark BookmarkName$. (Word adds a bookmark automatically when you insert a form field.) GetFormResult() returns values as follows:

Note that an error occurs if you use GetFormResult() with a text form field.

GetFormResult$() returns a string corresponding to the setting of the form field marked by the bookmark BookmarkName$. GetFormResult$() returns values as follows:

Example

This is an example of an "on-exit" macro that tests the item selected in a drop-down form field as soon as the user moves the focus to another form field. If the item is "Paris," a message box is displayed. The on-exit macro is assigned to the field marked by the bookmark "Dropdown1."


Sub MAIN
city$ = GetFormResult$("Dropdown1")
If city$ = "Paris" Then
MsgBox "We offer daily excursions to Versailles!"
End If
End Sub

For more information about on-exit macros, see Chapter 9, "More WordBasic Techniques," in Part 1, "Learning WordBasic."

See Also

SetFormResult