Solved

Getting combobox to display values in a form in Word 2003

Posted on 2008-06-12
4
502 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now