How to create a dropdown user control?

How to make multiselect dropdown lists

  • Form creation on MS Word 2003 on an XP system. How do I make an MS Word doc with a multiple-selection dropdown listbox? I know this can be done using VB, but I don't know VB. I've made forms before using dropdown boxes from the Forms toolbar in Word (as opposed to the Control Toolbox toolbar) but the user can make only one selection from the list. I'd like the dropdown list to allow for non-contiguous item selection. That is, if the list items were "red", "green", "yellow", "blue", "orange", and "purple", a user could select one, any, or all of them. I need one of the following: a) clear instructions to use the built-in tools in Word to do what I want b) a reference that a complete VB noob can use to build a multi-select dropdown listbox -- fast. Can anyone help with one or the other?

  • Answer:

    I've done this in MS Access. http://www.fontstuff.com/access/acctut11.htmto a helpful bunch of VB code to do it there. The challenge with multi-selection list boxes is that you have to figure out how the data will be stored. With a single selection, it's simple - you just have the selection go into one variable. With multiple selections possible, you don't know how many variables you'll need. People might choose one, all, or none of the selections. In Access/VBA coding, the way you do it is loop through all the items in the list to see which ones were selected, and as you're doing that, you keep adding each selection to a string that ultimately becomes a clause in a SQL query. I suppose you could use a similar strategy in Word, except the extended string becomes what's stored in the variable. Your next challenge though would be to figure out how to extract and use the string data that would be "red yellow orange" for one person and "blue orange purple" for the other.

angiep at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

This may not be as elegant, but what about just using a list with check boxes (from the forms toolbar) for each item? Please select you choice of color(s) (choose all that apply): --checkbox-- red --checkbox-- green --checkbox-- yellow --checkbox-- blue etc.

jeoc

Thanks, jeoc. I'd already decided to do that if I can't get the dropdown list to work. Unfortunately, my list is much longer than half a dozen colours, and the text for each choice is a 5-10 word sentence. I was looking for something that would be a little more elegant. I'm caught in the old trap of good-fast-cheap, where only two of them can work at any one time. Thanks for trying to help, though!

angiep

Thanks so much, Jasper! The site you referenced is super.

angiep

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.