Document Editing Problems

How to Create Dependent Drop-Down Lists and Calculate Totals in Word Forms

Anum MushtaqAnum Mushtaq Oct 26, 2026 869 views

Question details

The user needs to create a reliable order form with dependent item, color, and size fields that accurately calculates surcharges, discounts, taxes, and totals.

How to Create Dependent Drop-Down Lists and Calculate Totals in Word Forms
Product
Microsoft Word
Device & OS
not provided
Scenario
Building a complex order form where secondary drop-down choices (like color) depend on the primary selection (like item), alongside conditional pricing and row calculations.
Observed behavior
Legacy form fields and deeply nested IF fields are not updating reliably when handling multiple interdependent conditions and complex arithmetic.
Before you start

Ensure the Developer tab is enabled in your Word ribbon, as you will need access to Legacy Form Fields and the Visual Basic (VBA) editor to configure these dynamic dependencies.

Solution 1Recommended

Use VBA and Systematic Bookmark Naming for Form Fields

By renaming form-field bookmarks with a consistent two-digit suffix and using a unified VBA macro, you can dynamically update dependent lists and calculate complex row totals reliably.

Deeply nested IF fields often fail to update correctly in complex forms. Instead, standardizing your form field names allows a single VBA procedure to manage all rows.

The script will identify the active row, temporarily unprotect the document to modify the dependent lists, perform calculations like size surcharges, and then reprotect the document.

1
Standardize Bookmark Names

Double-click each legacy form field to open its options. Set the Bookmark name using a two-digit row suffix for consistency (e.g., ItemNumber01, Colors01, Quantity01).

2
Create the VBA Procedure

Press Alt + F11 to open the VBA editor. Write a macro that extracts the two-digit suffix from the currently active form field to determine which row the user is modifying.

3
Unprotect and Populate Fields

In your macro, use the ActiveDocument.Unprotect method. Based on the selected 'ItemNumber', programmatically clear and populate the list entries of the corresponding 'Colors' drop-down field for that specific row.

4
Calculate Totals and Reprotect

Add logic to evaluate the selected size (e.g., adding a $2 surcharge for 2XL), multiply the final base price by the quantity, update the line total field, and finally run ActiveDocument.Protect to resume form functionality.

Use VBA and Systematic Bookmark Naming for Form Fields
Assigning the Macro: Remember to assign your VBA macro to run 'On Exit' in the properties of the primary drop-down field (e.g., the Item list) so it triggers as soon as the user makes a selection.
Advanced Document Editing

Easily Create Dynamic Forms with WPS Writer

WPS Writer offers full support for legacy form fields and comprehensive document protection tools, making it simple to design professional order forms that are fully compatible with Microsoft Word.

  1. 1. Access the Developer Tab: Open WPS Writer, navigate to the top ribbon, and click on the Developer tab to access advanced form tools.
  2. 2. Insert Form Fields: Click 'Drop-Down Form Field' to insert lists, then double-click the field to configure list items and assign bookmark names.
  3. 3. Protect the Form: Click 'Restrict Editing' and check 'Allow only this type of editing', selecting 'Filling in forms' to activate the drop-down functionalities.
Fully compatible with Microsoft Word DOCX formatsBuilt-in Developer tools for legacy form fieldsIntuitive document protection for secure form filling
microsoft office alternative - wps office

Frequently Asked Questions

Why do my legacy form fields require the document to be protected?

Legacy form fields only become interactive drop-downs and trigger 'On Exit' macros when the document is restricted to 'Filling in forms'. Otherwise, clicking them will simply select the field for structural editing.

Can I use nested IF fields instead of VBA for calculations?

While nested IF fields work for simple arithmetic like basic sales tax, VBA is highly recommended for complex, interdependent calculations (like conditional size surcharges) to ensure fields update reliably without manual intervention.

Can I copy and paste rows without breaking the VBA macro?

If you copy and paste rows to expand your form, you must manually update the bookmark names in the new row to increment the two-digit suffix (e.g., changing '01' to '02'). This ensures the VBA macro processes the correct set of fields.