logo
search
Document Editing Problems

How to Show or Hide Word Content Based on a Check Box

Chanuka GeekiyanageChanuka Geekiyanage Oct 10, 2026 868 views

Question details

The user needs a way to conditionally display or conceal specific document content depending on whether a form check box is ticked or unticked.

How to Show or Hide Word Content Based on a Check Box
Product
Microsoft Word
Device & OS
not provided
Scenario
Creating a dynamic digital form where supplemental sections, questions, or instructions only appear when the user selects the corresponding check box.
Observed behavior
Word does not offer a built-in conditional formatting feature for document forms, making it impossible to link content visibility directly to a check box state without implementing custom VBA macros.
Before you start

Since this solution requires VBA, ensure that the Developer tab is enabled in your Word ribbon and that your document is saved as a Macro-Enabled Document (.docm).

Solution 1Recommended

Use an ActiveX Check Box and a VBA Macro

This is the most reliable method for toggling text visibility. By assigning a VBA macro to an ActiveX check box, you can instantly show or hide bookmarked text when the user clicks the box.

ActiveX controls interact directly with VBA, allowing the document to respond immediately to user clicks.

To make this work, the text you want to show or hide must be enclosed in a Bookmark. This provides the VBA code with an exact reference to the content it needs to modify.

1
Enable the Developer Tab

Go to File > Options > Customize Ribbon. In the right pane, check the box next to 'Developer' and click OK.

2
Bookmark the Target Text

Highlight the text or section you want to hide. Go to the Insert tab, click 'Bookmark' in the Links group, type a name like 'HiddenSection' (without spaces), and click Add.

3
Insert an ActiveX Check Box

Place your cursor where you want the check box. Go to the Developer tab, click the 'Legacy Tools' briefcase icon in the Controls group, and select the 'Check Box (ActiveX Control)' icon.

4
Add the VBA Code

Double-click the newly inserted check box. This opens the VBA Editor. In the code window for 'Private Sub CheckBox1_Click()', type: If CheckBox1.Value = True Then ActiveDocument.Bookmarks("HiddenSection").Range.Font.Hidden = False Else ActiveDocument.Bookmarks("HiddenSection").Range.Font.Hidden = True End If.

5
Test the Check Box

Close the VBA Editor. On the Developer tab, click 'Design Mode' to turn it off. You can now click the check box to instantly toggle the visibility of the bookmarked text.

Use an ActiveX Check Box and a VBA Macro
Hidden Text Display Settings: If you still see the text with a dotted underline when it should be hidden, your Word display settings are overriding the macro. Go to File > Options > Display and uncheck 'Hidden text'.
Free Microsoft Office alternative

Experience Hassle-Free Document Editing with WPS Office

While Microsoft Word requires complex VBA macros and Developer tools just to create dynamic forms, WPS Writer provides a lightweight, intuitive, and highly compatible environment for all your document formatting needs.

  1. 1. Download and Install: Get WPS Office for free from the official website and run the quick installer.
  2. 2. Open Your Document: Launch WPS Writer and seamlessly open your existing Word files with complete layout retention.
  3. 3. Edit and Format: Enjoy a smooth, fast, and feature-rich document editing experience without the bloat.
Fully compatible with Microsoft Word (.docx, .doc, .docm) formatsLightweight software that launches instantly on Windows, Mac, and LinuxFamiliar ribbon interface ensures zero learning curve for Office usersBuilt-in PDF editing, conversion, and digital signature toolsCompletely free to download and use for essential document creation
microsoft office alternative - wps office

Frequently Asked Questions

Can I show or hide content in Word forms without using macros?

No, Microsoft Word lacks a native conditional formatting engine for forms. You must use VBA macros to evaluate a check box's state and subsequently toggle the visibility of specific text.

Why doesn't my ActiveX check box trigger the VBA code when clicked?

You are likely still in Design Mode. Navigate to the Developer tab on the ribbon and click the 'Design Mode' button to disable it. Once disabled, the controls in your document become interactive.

Does this VBA method work with Content Control check boxes?

Yes, but it requires a different approach. Instead of a simple Click event, you must use the Document_ContentControlOnExit event in the 'ThisDocument' module to detect changes when the user clicks away from the Content Control check box.

Will the hidden text still print if the check box is unticked?

By default, hidden text does not print. However, to ensure it doesn't appear on paper, go to File > Options > Display and verify that the 'Print hidden text' option under Printing options is unchecked.