How do I set up a combobox on word?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to create a form using the control box, but I don't know how to
populate the comboBox in word.
 
Im trying to create a form using the control box, but I don't know how to
populate the comboBox in word.

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/dnword2k2/html/odc_activeX.asp
 
Back
Top