VBA & Macro Problems

Automatically Add Word Comments When Checkbox is Selected

Camila MilosovichCamila Milosovich Oct 21, 2026 869 views

Question details

The user needs to generate a text comment or summary automatically within a Word inspection checklist based on whether a content-control checkbox is selected, left blank, or set to No.

How to Automatically Add a Word Comment When a Checkbox Is Selected
Product
Word
Device & OS
not provided
Scenario
Creating an interactive inspection checklist or form where checking a box dynamically updates an adjacent text field or comment area.
Observed behavior
Requires a scripted method to detect the checkbox state (checked/unchecked) and output the corresponding text summary automatically.
Before you start

Ensure the Developer tab is enabled in your Word processor's ribbon, as you will need to insert content controls and write Visual Basic for Applications (VBA) code.

Solution 1Recommended

Use VBA ContentControlOnExit Event to Generate Summaries

Write a VBA macro that detects when a user interacts with a content-control checkbox and automatically updates a designated text field based on its state.

To automate text generation based on a checkbox state, you need to use Visual Basic for Applications (VBA). Specifically, the 'Document_ContentControlOnExit' event allows Word to monitor when a user interacts with and leaves a content control checkbox.

1
Enable Developer Tab and Insert Controls

Navigate to File > Options > Customize Ribbon and check the Developer box. Then, click the Developer tab on the ribbon, and insert a Check Box Content Control and a Plain Text Content Control from the Controls group into your document.

2
Assign Tags to Content Controls

Select your newly inserted checkbox, click Properties in the Developer tab, and set both the Title and Tag fields to 'Check1'. Repeat this for the plain text control, naming its Tag 'Summary1'.

3
Add the VBA Macro Code

Press ALT + F11 to open the VBA Editor. In the left panel, double-click 'ThisDocument'. Paste a VBA script that triggers on 'Document_ContentControlOnExit', checking if 'ContentControl.Tag = "Check1"'. Use an If statement to update the 'Summary1' range text based on whether 'ContentControl.Checked' is True or False.

4
Save as Macro-Enabled Document

Go to File > Save As and choose 'Word Macro-Enabled Document (*.docm)' from the format dropdown. If you save it as a standard DOCX file, your macro code will be permanently deleted.

Use VBA ContentControlOnExit Event to Generate Summaries
Triggering the Macro: The VBA event 'ContentControlOnExit' only fires when you click away from the checkbox to another area of the document, not at the exact moment the box is clicked.
Free Microsoft Office alternative

Create Professional Forms and Checklists with WPS Office

If managing complex VBA macros and developer settings in Microsoft Word is becoming cumbersome, try WPS Office. It provides a highly intuitive interface for document creation, perfect for standard forms and checklists.

  1. 1. Download WPS Office: Visit the official WPS website and download the free WPS Office suite for your operating system.
  2. 2. Open Your Document: Launch WPS Writer and open your existing Word forms or checklists to ensure perfect layout compatibility.
  3. 3. Insert Form Fields: Navigate to the Insert tab to easily add interactive elements like checkboxes to your documents.
Seamlessly opens, edits, and saves Microsoft Word (.docx, .docm) formats.Intuitive form building tools available directly in the user interface.Free, lightweight, and fast to launch on Windows, Mac, and mobile devices.Familiar ribbon layout means zero learning curve when switching from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my VBA macro triggering when I click the checkbox?

The 'ContentControlOnExit' event only fires when your text cursor exits the content control. After clicking the checkbox, you must click somewhere else in the document or press the Tab key to trigger the macro and generate the summary.

Can I use Legacy Form Field checkboxes instead of Content Controls?

Yes. If you use Legacy Form Fields from the Developer tab, you can double-click the checkbox to open its properties, check the 'Calculate on exit' option, and select your specific macro from the 'Run macro on exit' dropdown menu.

Will my automatic comments work if I send the document to someone else?

It will only work if the recipient opens the document in a desktop version of Word that supports VBA macros, and they must click 'Enable Content' when the security warning prompts them to allow macros to run.