Creating drop-down menu in Word 2003

R

Raziel014

Hi, I'm trying to create a drop-down menu which is supposed to be really
simple.
I've insterted a Drop-Down Form Field into the document and doubleclick it
to add Drop-down items. Now this is ok. But it doesn't turn out as a
drop-down menu!
There's no way to actually "drop the menu down" if you know what I mean.
It just looks like a general field and not a drop-down menu which lists up
all items I've added.

Am I not getting something here?
 
J

Jean-Guy Marcil

Raziel014 was telling us:
Raziel014 nous racontait que :
Hi, I'm trying to create a drop-down menu which is supposed to be
really simple.
I've insterted a Drop-Down Form Field into the document and
doubleclick it to add Drop-down items. Now this is ok. But it doesn't
turn out as a drop-down menu!
There's no way to actually "drop the menu down" if you know what I
mean. It just looks like a general field and not a drop-down menu
which lists up all items I've added.

Am I not getting something here?

You have to protect the document for forms to enable the fields.
Have you protected the document?

If protecting the document is not what you want, then you will need to use a
Combobox from the Control Toolbox toolbar, and a macro to load the values,
let us know if this is something you want to try.
 
R

Raziel014

Yes, I would like to try that. Because protecting the document screws up alot
of other things. So we can't have that :)
 
K

Kenny Bones

And another thing. Somehow, protecting the document in this case doesn't show
the button for the drop-down list. It's strange, I can do the exact same
thing in a new document and it works just fine. Can't seem to see any other
differences in the documents either. But there's gotta be something.

After protecting the document, nothing happens to the field. It just looks
like it's in edit mode still. Any thoughts?
 
K

Kenny Bones

Just found out another thing.
The reason the drop-down doesn't work is because I have several sections in
my document and I need to check the section the drop-down list is in for it
to work.

But the thing is, the drop-down list is in a table.. And I cannot add
section breaks in a table. Therefore, the whole table is protected. And
that's not good at all.
 
G

Graham Mayor

I take it that you and Raziel014 are one and the same person?
Dropdown fields require the document to be protected in order to work.
Documents that require free editing are generally not suited to the use of
form fields.
What is it that you are trying to achieve?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Kenny Bones

Well, I have a rather larger template which contains several sections.
In on of these sections, I have a larger table which contains simple "type
text here" -fields, but two fields need to have a drop-down list.

And, in order for the drop-down lists to actually work, I need to protect
the section. And since I cannot add a section break inside a table, the whole
table gets protected. And thus, the user cannot type text in the previous
simple "type text here"-fields in the same.

What I would like is a macro that "sense" that if the user clicks either on
the drop-down-field or the table it's contained in, the document should get
protected so that the drop-down lists will actually work. And when the user
has clicked on one of the drop-down list choices, the document should get
unprotected.
 
D

Doug Robbins - Word MVP

Display the Controls toolbar and then insert a combobox in the location
where you want it. By default it will be given the name of ComboBox1, but
if you right click on it, you can change the name by selecting the
Properties item (and also set other features of the combobox).

Assuming that you leave the name as ComboBox1, in the This Document object
in the Visual Basic Editor, insert a macro containing the following code:

Sub AutoOpen()
Dim mylist As Variant
Dim i As Long
mylist = Split("Item1/Item2/Item3/Item4/Item5/Item6/Item7/etc.", "/")
'Replace these items with those that you want to appear in the list
With ComboBox1
For i = 0 To UBound(mylist)
.AddItem mylist(i)
Next i
End With
End Sub

In the document itself, make sure that you exit the design mode and then
save and close the document.

When you open the document, accept the macro security warning and then try
the combobox.

If you want to avoid the macro security warning, change the name of the
macro to AutoNew() and save the document as a template in your templates
folder. Then use File>New and select the template as the basis of the
document that you want to create.

--
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, originally posted via msnews.microsoft.com
 
G

Graham Mayor

Unfortunately what you think you need to do to achieve this, may not be the
best way to actually achieve the aims of the document as a whole.

Let's start by determining what sort of fields have you used for 'type text
here fields'?

It may be better to replace those fields with text form fields, then there
is no reason to unlock the form in order to fill them. This would certainly
be the better approach if the document was being made available for third
parties to complete as there is no way to force users to run macros against
their better judgement.

Alternatively it may be better to use macrobutton fields to call a userform
that contains your dropdown selections. You might also want to consider
controls from the control toolbox.

Give us an overview of what you are trying to achieve and not simply
restrict your comments to the particular issue of the dropdown field. For
example what user input will be required in the others sections of the
document?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Kenny Bones

But a ComboBox, how does that look like when printing?
I really don't want the look of a winforms control. I just want the user to
be able to select from a drow-down list some choices. And the selected choice
get added as text, which needs to be formatted to a special font as well.

This I can achieve by using the drop-down list. But as I said, I need to
have a macro which protects the document if the field is selected, making the
drow-down list actually work. And when the user is done selecting, the
document should get unprotected.
 
K

Kenny Bones

Wow, thanks! :)
Didn't know that a text form field is available even after protecting the
document. Kinda makes sense though..

Anyway, this may be the best way of doing this, I agree. I can just make
sure that the whole table is alone inside a section and just protect that
section.
But do you know how to make sure the text fields stay there as fields even
after they've been typed in?
 
G

Graham Mayor

Formfields will remain formfields as long as the section they are in remains
protected and you don't attempt to use them while it is not. The user can
simply tab between them.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Kenny Bones

Ok, that makes sense :)
But I noticed that after protecting the document and clicking the fields,
they aren't marked. In other words, the existing text isn't replaced with
the newly typed text. Am I doing anything wrong here?
 
G

Graham Mayor

If you tab into a form field the whole field is selected, so if you have
default text in there it will be overwritten. If you select a field with a
mouse the cursor simply adds to the field unless you ensure that the field
content is selected.
Did you leave your old fields in place or replace them with the form fields?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Kenny Bones

I replaced the old fields with the form fields and gave them a default text.
If I press tab, the entire field is selected as you say.

But if I simply use the cursor and click in one of the fields, the cursor is
placed where I clicked, but it doesn't select the entire field as it does
when pressing Tab. I would like to make sure the entire field is selected, if
possible.
 
G

Graham Mayor

Double click it!

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top