Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I add a combobox in a word document without creating a form? Is there a possible way? I've seen comboboxes in Excel, is it possible in word?

share|improve this question
    
What are you trying to accomplish? Word "fields" could be what you're after –  RJFalconer Jun 1 '10 at 18:18
    
I have a table in a word document with all its values based on one colour, however this has to be done for 8 colors. Instead repeating myself, I want something that will change values when a color is picked. –  John Jun 1 '10 at 18:22
add comment

1 Answer

You have to write VBA (macro) code in the Document_New and Document_Open procedures.

The simplest method, if the contents of the list will always be the same, is to use something like

Private Sub Document_New()
With ComboBox1
.AddItem "one"
.AddItem "two"
' etc.
.ListIndex = 0
End With
End Sub

You'd need the same thing in Document_Open, because the combo box doesn't store the list in the document file when the document is closed.

If you need to get values from a database, see the combo box part of the article at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwor...2/html/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.