Solved

Getting combobox to display values in a form in Word 2003

Posted on 2008-06-12
4
520 Views
Last Modified: 2013-12-26
Ok, this one should be simple, I know, but I just cannot figure it out.

I have a form in Word 2003 which has a couple of combo boxes on it. I want these combo boxes to have a list of values for the user to select from. This list is static and doesn't need to be pulled from elsewhere.

How on earth do I get the list of values into the combo box?

One is called "DocType" and the other "Category". I have tried code like this:

With Me.Category
        .AddItem ("Bible")
etc

and it doesn't work, no error, just no values.

If I can get this working I'll be very happy :)

Thanks
0
Comment
Question by:chuckalicious
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 21768882
Does it have to be through VBA? If you right-click your combo box and select properties, you'll get the Drop-Down Form Field Options dialog box. Enter your item in the Drop-Down item box and select "Add". This will add it to your combo box.

Flyster
0
 
LVL 4

Author Comment

by:chuckalicious
ID: 21768935
I do not get any "Add" option.

To make sure we're on the right track here, I have a macro in Word 2003 which uses a form, also created via the MS VB editor in Word. When I right click on the ComboBox, I get a long list of properties/options, but none which give any kind of Add option....

And no, it doesn't need to be done programatically, I just want the values in the fields :)
0
 
LVL 22

Accepted Solution

by:
Flyster earned 125 total points
ID: 21778422
Sorry for the delay, I have only one computer with 2003. The dialog box i described above was obtained from right-clicking the combo box on the form. I can't seem to find what you're getting. You should be able to populate those box during your open event. Try this code:

Sub BoxList()
With ActiveDocument.DocType
.Clear
.AddItem "Doc1"
.AddItem "Doc2"
.AddItem "Doc3"
End With

With ActiveDocument.Category
.Clear
.AddItem "Cat1"
.AddItem "Cat2"
.AddItem "Cat3
End With

End Sub

Hope it works for you.
0
 
LVL 4

Author Closing Comment

by:chuckalicious
ID: 31466482
See!! I knew it was something simple!!

I was using this same code, however I had it in the initialise of the form, instead of the enter event of the dropdown!

Works perfectly, thank you :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question