Document Editing Problems

How to Create Dependent Checkboxes to Show or Hide Tables in Word Forms

John WilsonJohn Wilson Oct 29, 2026 869 views

Question details

The user wants to configure a Word form where selecting a content-control checkbox dynamically displays or hides specific related editable tables.

How to Create Dependent Checkboxes to Show or Hide Tables in Word Forms
Product
Word
Device & OS
not provided
Scenario
Creating dynamic, interactive forms where specific sections or tables only appear when their corresponding checkbox is checked, keeping the document clean for saving or printing.
Observed behavior
Tables remain completely hidden until the user selects the linked content-control checkbox, which triggers the table to appear dynamically.
Before you start

Ensure the Developer tab is enabled in your Word ribbon and verify that you have a basic understanding of VBA, as this solution requires using macros to detect checkbox changes.

Solution 1Recommended

Use VBA Macros and Content Controls to Toggle Table Visibility

Create a macro-enabled template and utilize the Document_ContentControlOnExit event to automatically change the hidden-text attribute of your tables when checkboxes are clicked.

By default, standard Word checkboxes do not automatically show or hide text. To achieve dynamic visibility, you must use Content Control Checkboxes linked to a VBA macro. The macro listens for when a user interacts with the checkbox and subsequently toggles the 'Hidden' font formatting of the target table.

1
Enable the Developer Tab

Navigate to File > Options > Customize Ribbon. In the right pane, check the box next to 'Developer' and click OK to add the Developer tab to your ribbon.

2
Insert Checkboxes and Set Properties

Go to the Developer tab and click the 'Check Box Content Control' icon to insert your checkboxes. Click 'Properties' in the Developer tab, give each checkbox a unique 'Title' and 'Tag', and check 'Use a style to format text typed into the empty control'.

3
Insert and Hide the Tables

Insert the tables you want to link below the checkboxes. Select the entire table, press Ctrl+D to open the Font dialog, check the 'Hidden' box, and click OK so the table is hidden by default.

4
Add the VBA Macro

Press Alt+F11 to open the VBA Editor. In the Project Explorer, double-click 'ThisDocument'. Select 'Document' from the left dropdown and 'ContentControlOnExit' from the right dropdown. Write a VBA script that checks the ContentControl.Title and toggles the .Font.Hidden property of the specific table's range based on the checkbox's state.

5
Save and Test the Form

Save your document as a Macro-Enabled Word Template (*.dotm) or Document (*.docm). Close the VBA editor, click your checkboxes, and verify in Print Preview that the tables hide or display as intended.

Use VBA Macros and Content Controls to Toggle Table Visibility
Macro Security Check: For this dynamic form to work on other computers, users must click 'Enable Content' or 'Enable Macros' when opening the document. Without macros enabled, the checkboxes will not trigger the tables to appear.
Create Dynamic Forms in WPS Writer

Easily Build Macro-Enabled Forms with WPS Writer

WPS Writer offers full support for developer tools, content controls, and VBA macros, allowing you to easily construct professional, dynamic forms that respond to user input without needing expensive software.

  1. 1. Download and Open WPS Writer: Launch WPS Office and create a new document in WPS Writer.
  2. 2. Access the Developer Tools: Go to Menu > Options > Customize Ribbon and enable the 'Developer' tab to access form controls.
  3. 3. Insert Controls and Macros: Use the Developer tab to insert Checkbox Form Fields and open the VBA Editor to write your dynamic visibility scripts.
Seamless format compatibility with Microsoft Word macro-enabled files (.docm, .dotm)Built-in Developer tools for quick insertion of form fields and checkboxesPowerful and lightweight VBA editor to script dynamic document behaviors smoothly
microsoft office alternative - wps office

Frequently Asked Questions

Why are my hidden tables still showing up when I print the form?

Word has a setting that allows printing of hidden text. To fix this, go to File > Options > Display, and ensure that 'Print hidden text' is unchecked before printing your form.

Do end-users need to enable macros to use this dynamic form?

Yes. Because the show/hide functionality relies on the Document_ContentControlOnExit VBA event, anyone filling out the form must enable macros when they open the document for the tables to appear.

Can I use legacy form fields instead of content controls for this?

Yes, you can use legacy checkbox form fields. However, instead of the ContentControlOnExit event, you would assign an 'On Exit' macro directly in the legacy checkbox's properties window to trigger the table visibility code.