Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
MEME MEME is offline
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for combo/drop down list ah Microsoft Word Help 12 October 3rd 07 01:35 PM
Need to add items to combo box (drop down box)? AMC Microsoft Word Help 3 August 22nd 07 08:20 PM
Drop List Options Dependent On Another Drop Down List Option Sidneychic.Admin Microsoft Word Help 9 July 24th 07 09:15 PM
Combo boxes and drop down lists- basic question Erica Lais New Users 3 October 18th 05 05:53 PM
Drop-down List where items in drop-down list hyperlink to a webpage? gully New Users 4 April 24th 05 09:58 AM


All times are GMT +1. The time now is 02:10 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"