Combo Box in Form

A

Ann Shaw

Hi

I have a combo box in a form using Control Toolbox. I
need to know how to populate the list. In the properties
of the field there is does not seem to be anywhere to
enter the list of values.

Thanks in advance

Ann
 
J

Jay Freedman

Hi

I have a combo box in a form using Control Toolbox. I
need to know how to populate the list. In the properties
of the field there is does not seem to be anywhere to
enter the list of values.

Thanks in advance

Ann

Hi Ann,

You have to write VBA (macro) code. There are many issues to consider,
for example:

- Does the list always contain the same values (so the list may be
stored within the macro code or in the template's "document
properties"), or does it change from time to time or for each document
(so the list should be stored externally, in another document or in a
database)?

- If you choose a particular value from the list and save the
document, then reopen the document, do you need to have the same value
still selected? If so, you need to have macro code to store the
selection in a document variable (in the document, not in the
template), and you need code in the document's Open procedure to read
the property and set the selection accordingly.

- Do you want to allow the user to type in values that aren't in the
list? If so, do you want to add those values permanently to the list?

If all of this is too much for you to deal with, or if you don't want
to spend time learning VBA, you have two alternatives:

(a) Use a dropdown from the Forms toolbar -- but that will force you
to protect the document for forms, which has its own drawbacks and
limitations. Among them is that a dropdown can hold a maximum of 25
items, each with no more than 50 characters.

(b) Post your request in the microsoft.public.word.vba.userforms
newsgroup and ask for someone to write the code for you. They'll need
answers to all the questions above, and probably some more
information.
 

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