Skip to main content

How to create dependent drop-down lists in a Word document?

Author: Siluvia Last Modified: 2025-04-11
Example showing limiting the choices in the second drop-down list based on the selected option in the first drop-down list

As shown in the screenshot, you may want to limit the choices in the second drop-down list based on the selection made in the first drop-down list. This article shows you how to create dependent drop-down lists in a Word document.

Create dependent drop-down lists in Word with VBA code


Create dependent drop-down lists in Word with VBA code

The VBA method below helps you create a dependent drop-down list where the second list changes based on what is selected in the first list. Follow these steps:

  1. Make sure the "Developer" tab is visible in your Word ribbon (if not, see the tutorial How to show the Developer tab in Word?). Then insert two drop-down lists by clicking "Developer" > "Legacy Forms" > "Drop-Down Form Field" twice.
    Developer tab with Legacy Forms selected and Drop-Down Form Field highlighted
  2. Right-click the first drop-down (this will be the parent list) and click "Properties".
    First drop-down list right-clicked with Properties option selected
  3. In the "Drop-down Form Field Options" dialog:
    1. Enter the categories (e.g., "Fruit", "Vegetable", "Meat") into the "Drop-down item" box one at a time, clicking "Add" after each.
    2. Type "ddfood" in the "Bookmark" box.
    3. Click "OK".
      Drop-down Form Field Options dialog box
  4. Right-click the second drop-down list, select "Properties", type "ddCategory" in the "Bookmark" box, and click "OK".
    Drop-down Form Field Options dialog box
  5. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  6. In the VBA window, click "Insert" > "Module", then paste the following code:
    Sub Populateddfood()
    'Update by Extendoffice 2018/10/25
        Dim xDirection As FormField
        Dim xState As FormField
        On Error Resume Next
        Set xDirection = ActiveDocument.FormFields("ddfood")
        Set xState = ActiveDocument.FormFields("ddCategory")
        If ((xDirection Is Nothing) Or (xState Is Nothing)) Then Exit Sub
        With xState.DropDown.ListEntries
            .Clear
            Select Case xDirection.Result
                Case "Fruit"
                    .Add "Apple"
                    .Add "Banana"
                    .Add "Peach"
                    .Add "Lychee"
                    .Add "Watermelon"
                Case "Vegetable"
                    .Add "Cabbage"
                    .Add "Onion"
                Case "Meat"
                    .Add "Pork"
                    .Add "Beef"
                    .Add "Mutton"
            End Select
        End With
    End Sub

    Notes:

    • In the code, change the items under each "Case" statement to suit your content.
    • "ddfood" and "ddCategory" must match the Bookmark names you entered in the "Drop-down Form Field Options" dialog boxes.
  7. Save the code and return to your document.
  8. Right-click the first drop-down list again and select "Properties". In the "Drop-down Form Field Options" dialog box that appears, from the "Exit" dropdown list, choose the macro name "Populateddfood", then click "OK".
    Drop-down Form Field Options dialog box
  9. Click "Developer" > "Restrict Editing".
    Restrict Editing button on the Developer tab on the ribbon
  10. In the "Restrict Editing" pane:
    1. Check "Allow only this type of editing in the document".
    2. Select "Filling in forms" from the dropdown list.
    3. Click "Yes, Start Enforcing Protection".
    4. In the "Start Enforcing Protection" dialog, set a password and click "OK".
      Restrict Editing pane and Start Enforcing Protection dialog

Now the dependent drop-down list is active. When you select "Fruit" in the first list, only fruit options will appear in the second list.

Examples showing limiting the choices in the second drop-down list based on the selected option in the first drop-down list

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

๐Ÿค– Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...

๐Ÿ“˜ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

โœ Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...

๐Ÿงน Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

โž• Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...

๐Ÿ” Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...

โญ Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...

๐ŸŒ Supports 40+ Languages: Use Kutools in your preferred language โ€“ supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools and Kutools Plus tabs on the Word Ribbon
๐Ÿ‘‰ Want to try these features? Download Kutools for Word now! ๐Ÿš€
 

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word