Help!

creating drop down box with multiple choices

 
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User Forms RSS
Next:  IF formula with multiple conditions  
Author Message
Bim
External


Since: Jul 19, 2007
Posts: 1



PostPosted: Thu Jul 19, 2007 10:26 am    Post subject: creating drop down box with multiple choices
Archived from groups: microsoft>public>word>vba>userforms (more info?)

Hello all
I am comletely new to any word function besides typing, but recently learned
some new tricks. I wanted to know how and if it is possible to create a drop
down box that can have multiple selections and display those selections in
the word document. Thanks much
Back to top
corky_guy
External


Since: Jul 12, 2007
Posts: 6



PostPosted: Fri Jul 20, 2007 12:46 am    Post subject: Re: creating drop down box with multiple choices [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Try this:


Crate a ComboBox and call it ComboBox1 (it's default name)
Crate a doc variable and call it dropdown

Copy and past this into your VBA Code:

Private Sub UserForm_Initialize()
With ComboBox1
.AddItem " "
.AddItem "Blah"
.AddItem "Yada"
.AddItem "Bada"
.AddItem "Bing"
End With
End Sub


Private Sub CommandButton1_Click()
Dim dropdown As MSForms.ComboBox


With ActiveDocument
.Variables("dropdown").Value = ComboBox1.Text
.Fields.Update
End With
Me.Hide
End Sub
Back to top
Jay Freedman
External


Since: Mar 17, 2004
Posts: 3038



PostPosted: Fri Jul 20, 2007 1:31 am    Post subject: Re: creating drop down box with multiple choices [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 19 Jul 2007 06:26:06 -0700, Bim
wrote:

>Hello all
>I am comletely new to any word function besides typing, but recently learned
>some new tricks. I wanted to know how and if it is possible to create a drop
>down box that can have multiple selections and display those selections in
>the word document. Thanks much

Word doesn't offer a dropdown box that can accept multiple selections.
You'll have to use a list box (which is always fully displayed, not
dropdown/rollup) in a userform (a custom dialog created in VBA).

For an introduction to userforms, see
http://www.word.mvps.org/FAQs/Userforms/CreateAUserForm.htm. The list
box is one of the controls in the toolbox when you're designing the
userform, and in its Properties list you can set the MultiSelect
property either fmMultiSelectMulti or fmMultiSelectExtended. Read the
VBA Help about the MultiSelect for the meanings of these values, and
read the topic on the Selected property to find out how the code can
determine which items the user selected.

I have to say that this isn't the topic I would have picked for
someone who doesn't know any VBA programming...

--
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
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User Forms All times are: Eastern Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can 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