From: airhockeycanada on 8 Jan 2010 12:22 Good day! I have developed a form with drop down menus in some places and free form fields in others. However, there are a few places where having a combination of the two would help. For instance, I'd like to give the user a choice of either using the selections in the drop down menu OR enter their own response free form in the field. How can this be done? Thank you. -- S. Ross
From: Greg Maxey on 8 Jan 2010 12:38 Using legacy formfields (Word2003 and ealier) you can. You could use ContentControls in Word2007 or a UserForm in any Word version (see: http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm) Using formfields about all you could do is provide and enable a text field for when the user selects the appropriate "provide your own input" option in a dropdown. For example the a dropdown may have the options A, B, C and Other. You would provide and textfield named "Other" and use the following entry and exit macros assigned to the Dropdown field: Sub DDOnExit() If ActiveDocument.FormFields("DropDown1").DropDown.Value = 4 Then ActiveDocument.FormFields("Other").Enabled = True Else ActiveDocument.FormFields("Other").Result = "" ActiveDocument.FormFields("Other").Enabled = False End If End Sub Sub DDOnEnter() ActiveDocument.FormFields("Other").Enabled = True End Sub airhockeycanada wrote: > Good day! > > I have developed a form with drop down menus in some places and free > form fields in others. However, there are a few places where having a > combination of the two would help. > > For instance, I'd like to give the user a choice of either using the > selections in the drop down menu OR enter their own response free > form in the field. > > How can this be done? > > Thank you.
From: Jay Freedman on 8 Jan 2010 13:00 What you described is called a "combo box" (because it's a combination of a dropdown control and a text entry control). If you and all your users have Word 2007, you can insert a combo box content control directly from the Developer tab of the ribbon. However, besides the obvious objection that lots of users don't have Word 2007, content controls don't mix very well with protected forms (now known by the euphemism "legacy controls"). To make a combo box in a form that can be used in Word 2003 or earlier, you have four possibilities. Three of them involve macros. 1. The macro-less version is simply to insert two form fields (a dropdown and a text field) next to each other, and include some text to the effect of "Please choose an item from the list or enter text in the box, but not both." Most users will understand this; the others need to be beaten about the head with a Nerf clue stick. ;-) 2. The next idea is to insert the same two fields in the form, but also write exit macros for the fields. Make the dropdown's first item "Please choose a value" or some such default. In the exit macro for the dropdown, if the result isn't the default, then set the text field's result to the default string (five nonbreaking spaces) and set its Enabled property to False. In the exit macro for the text field, if the result isn't the default string, then set the dropdown to its default result and set its Enabled property to False. This scheme ensures that only one of the fields can be filled at any one time. 3. Create a userform (a macro-driven custom dialog, http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm). One of the controls you can put on a userform is a real combo box. In the form document, put in only a text form field, and make its entry macro display the userform; when the user clicks OK in the userform, the macro transfers the text from the userform's combo box to the form document's text form field. 4. On the Control Toolbox toolbar, there is a combo box control. This is an ActiveX control that's rather difficult to use in Word (it's really intended for use in a Web page). See http://msdn2.microsoft.com/en-us/library/aa140269(office.10).aspx for help with this. One drawback is that it doesn't retain the entered information when you close the document, so you have to store the text in a document variable when the document is saved, and get that variable and restore the control's value when the document is reopened. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. airhockeycanada wrote: > Good day! > > I have developed a form with drop down menus in some places and free > form fields in others. However, there are a few places where having a > combination of the two would help. > > For instance, I'd like to give the user a choice of either using the > selections in the drop down menu OR enter their own response free > form in the field. > > How can this be done? > > Thank you.
|
Pages: 1 Prev: WORD: Change default font, paragraph and line spacing Next: Unwanted Spacing Before Footer |