1

I'm trying to follow the following instructions to add a combobox to a form and add some values to it for the user to pick: http://office.microsoft.com/en-gb/help/create-forms-that-users-complete-in-word-HP005230270.aspx

I've created a .dot and then dragged a combobox onto the document. When I double-click on it though, it opens up the VBA editor.

Do I have to add the items programatically as per the following question How do I add a combobox in Word? or is it possible to do this using the UI? The other question/answer refers to creating a form. Is there a step I've missed between creating a .dot to then create a form somehow before adding form elements to it?

Right clicking gives the following menu options:

  • Cut
  • Copy
  • Paste
  • properties
  • View code
  • Combo Box Object -> Edit or Convert
  • Format Control
  • Hyperlink

Choosing edit allows me to type some text onto the visible part of the control, but doesn't allow me to add multiple options

Right-clicking and selecting properties opens the following:

properties

2
  • Does it work if you right click and select properties rather than double click?
    – CharlieRB
    Commented Nov 22, 2011 at 17:37
  • Updated question to show what happens when I select properties
    – Kris C
    Commented Nov 22, 2011 at 20:03

1 Answer 1

1

From the searching I've done so far, it appears this can only be done programatically (at least in older versions of Word).

e.g. http://oreilly.com/pub/a/oreilly/windows/ron/combodrop_0100.html

Your guess that you needed to add some code to populate your drop-down combo box is quite correct. VBA allows you to assign a value to the combo box's Value and Text properties (in reality, they're the same property) from the user interface, which lets you add only a single item to a drop-down combo box. This, of course, isn't terribly useful, since presumably you're using the combo box to allow the user to choose from among multiple items. This is precisely one of those quaint features of the MSForms controls--in Microsoft's retail Visual Basic product, it's very easy to populate a combo box at design time.

In almost all cases, you want to populate the combo box before the user sees it, so that the user can select from among the available items. Fortunately, Word makes this easy. Whenever a document opens, Word checks the code behind a Word document for the presence of a procedure named Document_Open. If it is found, the code is executed. (The procedure, incidentally, is called an event handler, since it's automatically executed by Word in response to some event, in this case the document's being opened by the user.)

VBA code now added and working, but somewhat surprised that there didn't appear to be a way to do this through the menus...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .