|
| View previous topic :: View next topic |
| Author |
Message |
MEME Guest
|
Posted: Sat Dec 22, 2007 9:02 pm Post subject: 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 |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Sat Dec 22, 2007 9:02 pm Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
Jay Freedman Guest
|
Posted: Sun Dec 23, 2007 2:14 am Post subject: Re: 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 <miriamc2@verizon.net> wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|