Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
combo box- drop down list
Hi,
I have very little experience in programming. I'm trying to assign values to a drop down list (combo box) How you I do it? Thanks -- meme |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
combo box- drop down list
First, I'm assuming that you have a combo box from the Control Toolbox
and not the dropdown from the Forms toolbar -- they're completely different. The Forms dropdown doesn't require any programming (although you can use a macro to set one up, it isn't necessary). You need to make a template for your document. In the template, you have to write macros in the ThisDocument module named Document_New (which runs automatically when a document is created from the template) and Document_Open (which runs automatically when an existing document based on the template is re-opened). In each of those macros, you need code to add items to the combo box's list. It could look something like this: Private Sub Document_New() Populate ComboBox1 End Sub Private Sub Document_Open() Populate ComboBox1 End Sub Sub Populate(cbo As MSForms.ComboBox) With cbo .AddItem "one" .AddItem "two" .AddItem "three" .ListIndex = 0 End With End Sub Of course, you would replace the items in parentheses with the text you want in the list. You can add as many as you want. Also, it's a good idea to replace the default name of the combo box (ComboBox1) with something that reflects what the list is used for. A more complex method, but better for large amounts of data, is shown at http://msdn2.microsoft.com/en-us/library/aa140269(office.10).aspx. On Sat, 22 Dec 2007 13:02:00 -0800, MEME wrote: Hi, I have very little experience in programming. I'm trying to assign values to a drop down list (combo box) How you I do it? Thanks -- 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. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for combo/drop down list | Microsoft Word Help | |||
Need to add items to combo box (drop down box)? | Microsoft Word Help | |||
Drop List Options Dependent On Another Drop Down List Option | Microsoft Word Help | |||
Combo boxes and drop down lists- basic question | New Users | |||
Drop-down List where items in drop-down list hyperlink to a webpage? | New Users |