Document Editing Problems

Automatically Display an Amount from a Word Drop-Down List

Muhammad TalhaMuhammad Talha Nov 18, 2026 870 views

Question details

Display an amount in one table cell based on the selection in a Word drop-down list.

Automatically Display an Amount from a Word Drop-Down List
Product
Microsoft Word
Device & OS
not provided
Scenario
A Word form contains a drop-down list with options A, B, and C and a separate cell for the corresponding amount.
Observed behavior
Selecting A, B, or C should display $100, $200, or $300, respectively, in the destination cell.
Before you start

Open the document in a desktop version of Word that supports VBA, and enable the Developer tab if it is not visible. The drop-down must be a content control, not a legacy form field.

Solution 1Recommended

Use a DOCVARIABLE Field and VBA to Display the Matching Amount

Use this method when the amount can update after the user leaves the drop-down control.

1
Configure the drop-down

Select the drop-down content control, then choose Developer > Properties. Set its Title to DropDownCellA1 and add A, B, and C as list items if they are not already present.

2
Insert the destination field

Click the table cell where the amount should appear. Press Ctrl+F9 to insert field braces, type DOCVARIABLE A1 between them, and press F9. Do not type the braces yourself.

3
Add the document event

Choose Developer > Visual Basic. In the project for your document, open ThisDocument and paste the following code: Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Dim amount As String Dim docVar As Variable If ContentControl.Title <> "DropDownCellA1" Then Exit Sub Select Case ContentControl.Range.Text Case "A": amount = "$100" Case "B": amount = "$200" Case "C": amount = "$300" Case Else: amount = "-" End Select On Error Resume Next Set docVar = ThisDocument.Variables("A1") On Error GoTo 0 If docVar Is Nothing Then ThisDocument.Variables.Add Name:="A1", Value:=amount Else docVar.Value = amount End If ThisDocument.Range.Fields.Update End Sub

4
Save and test the form

Use File > Save As to save the document as a Word Macro-Enabled Document (.docm). Enable macros only if you trust the document, select A, B, or C, and then click outside the drop-down to update the amount.

Use a DOCVARIABLE Field and VBA to Display the Matching Amount
Update timing: The event runs when the user exits the drop-down. A Custom XML mapping approach is an alternative when an update is needed without leaving the control, but it requires additional setup.
Free Microsoft Office alternative

Edit Word Forms and Tables with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Word documents. Its format compatibility helps you move everyday document work to WPS Writer; the Word-specific VBA automation described above is not guaranteed to work in WPS.

Edit document tables and form content in WPS WriterOpen and save documents in Microsoft Word formats, including DOCXUse familiar document-editing tools for an easier transitionWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does the amount update only after I leave the drop-down?

The Document_ContentControlOnExit event runs when you leave the content control. Select an option, then click another part of the document to trigger it.

Can I type the braces around the DOCVARIABLE field?

No. Click the destination cell and press Ctrl+F9 to insert Word's field delimiters. Type DOCVARIABLE A1 inside them, then press F9.

Why does the field initially show an error?

The A1 document variable may not exist yet. Select an option and leave the drop-down while macros are enabled; the supplied event creates the variable and updates the field.

How do I change the amounts assigned to each option?

Open Developer > Visual Basic, open ThisDocument, and change the amount values in the Select Case lines. Save the macro-enabled document and test each option.