How to Use a Combo Box with a Text Form FieldLast reviewed: August 4, 1997Article ID: Q118482 |
6.00 6.00a
WINDOWS
kbusage kbmacro kbhowto
The information in this article applies to:
SUMMARYThis article describes how to create and use a combo box as an on-entry macro for a text form field. This macro can be used as a workaround for the 25-item limitation in drop-down form fields.
MORE INFORMATIONWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Create the following macro. To create the macro, from the Tools menu, choose Macro. Type "ComboBox" under Macro Name and choose the Create button. Type the following macro. (Make sure there is only one "Sub MAIN" and one "End Sub" in your macro.) Close and save the macro.
Sub MAINDim Array$(3) Array$(0) = "This" Array$(1) = "is" Array$(2) = "a" Array$(3) = "test" Begin Dialog UserDialog 320, 144, "Microsoft Word" ComboBox 10, 6, 160, 108, Array$(), .Text OKButton 201, 8, 88, 21 CancelButton 201, 35, 88, 21End Dialog Dim dlg1 As UserDialog n = Dialog dlg1 Select Case n Case - 1 Dim dlg2 As FormFieldOptions GetCurValues dlg2 SetFormResult dlg2.Name, dlg1.Text Case ElseEnd Select End SubIn your form, add a text form field. To insert this field, choose Form Field from the Insert Menu, choose Text and choose the OK button. Double- click the text form field. In the Text Form Field Options dialog box, select the ComboBox macro from the list of macros under Run Macro On Entry. Choose the OK button. When the form is finished, choose Protect Document from the Tools menu. In the Protect Document dialog box, choose Forms and choose the OK button. When you tab to this form field, the combo box will display. Kbcategory: kbusage kbmacro kbhowto KBSubcategory: |
Additional reference words: 6.00 6.00a dropdown form text field macro word6
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |