Help!

Drop down menu


Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> User Forms RSS
Next:  userform won't show & can't list sub folder n..  
Author Message
parkin_m
External


Since: Jun 06, 2007
Posts: 11



PostPosted: Wed May 30, 2007 9:40 am    Post subject: Drop down menu
Archived from groups: microsoft>public>word>vba>userforms (more info?)

Hi again!

I have a drop down menu that I would like to fill with "January, Feburary,
March.. etc"

I have the dropdown menu inside a form. Would a list box or a combo box be
better?

Also how do I actually fill the box with the dates? (I dont want to link to
some external place since the months will never change)
Back to top
Jay Freedman
External


Since: Sep 16, 2003
Posts: 2229



PostPosted: Wed May 30, 2007 1:55 pm    Post subject: Re: Drop down menu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

First, a couple of questions whose answers will determine what kind of
advice you need:

- What kind of "form" is this? A "protected form" with fields from the Forms
toolbar? A VBA-driven userform? Something else, such as an unprotected
document?

- What do you mean by a "drop down menu"? What behavior do you want?

In a protected form, you can have a "dropdown form field" but there is no
list box or combo box. In a VBA userform you can have either a list box or a
combo box, and the combo box can be limited so the user can only choose the
entries you supplied. In a nonprotected document, the object of choice is an
AutoTextList field. You could use a combo box from the Control Toolbox, but
that's more trouble than it's worth.

Trying to describe the "how" would be a waste of time until you choose the
"what".

--
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.

parkin_m wrote:
> Hi again!
>
> I have a drop down menu that I would like to fill with "January,
> Feburary, March.. etc"
>
> I have the dropdown menu inside a form. Would a list box or a combo
> box be better?
>
> Also how do I actually fill the box with the dates? (I dont want to
> link to some external place since the months will never change)
Back to top
Doug Robbins - Word MVP
External


Since: Jul 14, 2006
Posts: 2538



PostPosted: Wed May 30, 2007 7:56 pm    Post subject: Re: Drop down menu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Probably a combobox would be the most conventional for the user to be able
to select use one month.

Assuming that your combobox is name cmbMonth, you would load it with the
months by using

With cmbMonth
.AddItem "January"
.AddItem "February"


.AddItem "November"
.AddItem "December"
End With

In most probably the Initialize() event of your form.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"parkin_m" <parkinm RemoveThis @discussions.microsoft.com> wrote in message
news:F252714F-392C-4D49-8194-B2B4B10C207D@microsoft.com...
> Hi again!
>
> I have a drop down menu that I would like to fill with "January, Feburary,
> March.. etc"
>
> I have the dropdown menu inside a form. Would a list box or a combo box be
> better?
>
> Also how do I actually fill the box with the dates? (I dont want to link
> to
> some external place since the months will never change)
Back to top
parkin_m
External


Since: Jun 06, 2007
Posts: 11



PostPosted: Thu May 31, 2007 3:32 am    Post subject: Re: Drop down menu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

This is exactly what I ment, thank you.

I now have the combo box populated with the correct months in the
UserForm_Initalize() event.

How do I then add the selected option to my bookmark?
This is what I had previously:

With ActiveDocument
.Bookmarks("month").Range _
.InsertAfter month
End With

It is now not working. Do I need to do some kind of case statement to find
out which month was selected?

Thanks




"Doug Robbins - Word MVP" wrote:

> Probably a combobox would be the most conventional for the user to be able
> to select use one month.
>
> Assuming that your combobox is name cmbMonth, you would load it with the
> months by using
>
> With cmbMonth
> .AddItem "January"
> .AddItem "February"
>
>
> .AddItem "November"
> .AddItem "December"
> End With
>
> In most probably the Initialize() event of your form.
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "parkin_m" <parkinm.TakeThisOut@discussions.microsoft.com> wrote in message
> news:F252714F-392C-4D49-8194-B2B4B10C207D@microsoft.com...
> > Hi again!
> >
> > I have a drop down menu that I would like to fill with "January, Feburary,
> > March.. etc"
> >
> > I have the dropdown menu inside a form. Would a list box or a combo box be
> > better?
> >
> > Also how do I actually fill the box with the dates? (I dont want to link
> > to
> > some external place since the months will never change)
>
>
>
Back to top
Jay Freedman
External


Since: Sep 16, 2003
Posts: 2229



PostPosted: Thu May 31, 2007 9:46 am    Post subject: Re: Drop down menu [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Following on from Doug's assumption that the combo box is named cmbMonth,
you need to use that name to get the combo's selection:

With ActiveDocument
.Bookmarks("month").Range _
.InsertAfter cmbMonth.Value
End With

You might also want to have a look at
http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm.

--
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.

parkin_m wrote:
> This is exactly what I ment, thank you.
>
> I now have the combo box populated with the correct months in the
> UserForm_Initalize() event.
>
> How do I then add the selected option to my bookmark?
> This is what I had previously:
>
> With ActiveDocument
> .Bookmarks("month").Range _
> .InsertAfter month
> End With
>
> It is now not working. Do I need to do some kind of case statement
> to find out which month was selected?
>
> Thanks
>
>
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> Probably a combobox would be the most conventional for the user to
>> be able to select use one month.
>>
>> Assuming that your combobox is name cmbMonth, you would load it with
>> the months by using
>>
>> With cmbMonth
>> .AddItem "January"
>> .AddItem "February"
>>
>>
>> .AddItem "November"
>> .AddItem "December"
>> End With
>>
>> In most probably the Initialize() event of your form.
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>>
>> "parkin_m" <parkinm.DeleteThis@discussions.microsoft.com> wrote in message
>> news:F252714F-392C-4D49-8194-B2B4B10C207D@microsoft.com...
>>> Hi again!
>>>
>>> I have a drop down menu that I would like to fill with "January,
>>> Feburary, March.. etc"
>>>
>>> I have the dropdown menu inside a form. Would a list box or a combo
>>> box be better?
>>>
>>> Also how do I actually fill the box with the dates? (I dont want to
>>> link to
>>> some external place since the months will never change)
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) (change)
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