Create a Word VBA Combo Box to Insert a Selected Option
Question details
Create a Word VBA UserForm with two combo box choices and insert the selected choice into a document.

- Product
- Microsoft Word VBA
- Device & OS
- not provided
- Scenario
- A UserForm lets a user choose between an in-person and a phone option, then click OK to populate a document or template.
- Observed behavior
- The selected combo box value should appear in the intended document location after the user clicks OK.
Enable the Developer tab in Word and save the file as a macro-enabled document (.docm) or template (.dotm). Use macros only from a trusted source, and identify where the selected text should appear.
Insert the combo box selection into a tagged content control
Use a UserForm and a tagged content control to place one selected value at a specific location in the active document.
In the document, place the cursor where the answer should appear. On the Developer tab, insert a Plain Text Content Control, open Properties, and set its Tag to Location.
Open Developer > Visual Basic, select the document or template project, and choose Insert > UserForm. In the Properties window, name the form frmLocation, add a ComboBox named cmbLocation, and add a CommandButton named btnOK with the caption OK.
Open the form's code window and add this initialization procedure: Private Sub UserForm_Initialize() With cmbLocation .Clear .AddItem "in person" .AddItem "by phone" .MatchRequired = True End With End Sub
In the same form code window, add the OK button procedure: Private Sub btnOK_Click() Dim matches As ContentControls If cmbLocation.ListIndex = -1 Then MsgBox "Please select an option." Exit Sub End If Set matches = ActiveDocument.SelectContentControlsByTag("Location") If matches.Count = 0 Then MsgBox "The Location content control was not found." Exit Sub End If matches(1).Range.Text = cmbLocation.Value Unload Me End Sub
In the VBA editor, choose Insert > Module and add: Sub ShowLocationForm() frmLocation.Show End Sub Return to the document, choose Developer > Macros, and run ShowLocationForm. Select an option and click OK.

Edit Word documents with WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Word documents, making it easy to move everyday document work between office suites. It does not fix Microsoft Word VBA issues, and VBA UserForm compatibility may vary.

Frequently Asked Questions
Why does the form say the Location content control was not found?
In the active document, select the content control and open Developer > Properties. Make sure its Tag is exactly Location and that the intended document is active when you run the macro.
Can I use a list box instead of a combo box?
Yes. Add a ListBox to the UserForm and populate it with AddItem in UserForm_Initialize. For a single-selection list box, check its ListIndex and use its Value in the OK button procedure. Multi-select list boxes require looping through the Selected items instead.
How do I prevent the user from submitting a blank choice?
In btnOK_Click, check whether cmbLocation.ListIndex is -1 before writing to the document. If it is, show a message and use Exit Sub so the form stays open.
Where should I save the VBA code?
Save the document as a Word Macro-Enabled Document (.docm) or the template as a Word Macro-Enabled Template (.dotm). Put the event procedures in the UserForm's code window and the ShowLocationForm macro in a standard module.




