How to Create Dependent Drop-Down Lists and Calculate Totals in Word Forms
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.

- 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.
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.
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.
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).
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.
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.
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.

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. Access the Developer Tab: Open WPS Writer, navigate to the top ribbon, and click on the Developer tab to access advanced form tools.
- 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. Protect the Form: Click 'Restrict Editing' and check 'Allow only this type of editing', selecting 'Filling in forms' to activate the drop-down functionalities.

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.




