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?

link|improve this question

71% accept rate
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
feedback

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/

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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