Linked combo boxes in a userform

P

padre4096

I've put together a userform in Word 2000. I would like to set up combo boxes
where the options within the second combo box are defined by the selection
made in the first combo box.

As an example, if I was doing a survey on fast food and wanted to know what
restaurant someone had been to and what they had to eat. The first combo box
would have the different restaurants listed (McDonalds, Burger King etc) then
if you chose McDonalds in that combo box the second combo box would recognise
this and only display items that were relevant to McDonalds, i.e. it would
list Big mac, quarter pounder etc but not Whopper or whatever.
 
D

Doug Robbins - Word MVP

I usually do this by storing (to use your example) the restaurants, one to a
row in the first column of a two column table and menu items applicable to
each restaurant in individual paragraphs in the adjacent cell in the second
column of a document. Then, on loading the userform, the first combobox is
populated with the restaurants by iterating throught the cells of the first
column in the table and on selecting an item in that combobox. the
..ListIndex property of the combobox is used to determine the cell from which
the food items are added to the second combobox.

For an example of the code to do this, see:

http://groups.google.com/group/micr...doug's+combo+box+code&rnum=1#bf86a5657fe2c34e

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top