Share via

Checkbox adding a Comment box

Anonymous
2016-10-27T17:48:41+00:00

Hi,

I'm making a form on word. I added a checkbox in the form using developer tool. I was wondering if there was a way that when I check a checkbox, a comment box will appear?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2016-10-29T00:03:07+00:00

Use the following code:

Private Sub CheckBox1_Click()

 With ActiveDocument

     With .Variables("Comment")

         If CheckBox1.Value = True Then

             .Value = InputBox("Insert your comment here", "CheckBox Comment Facilty")

         Else

             .Value = " "

         End If

     End With

     .Range.Fields.Update

 End With

 End Sub

Then, when you check the box, a dialog will appear into which you can insert your comment, which will be displayed in the Docvariable field

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-10-28T14:17:09+00:00

    Hi Doug,

    That's a neat trick, but I want a comment box to activate when a checkbox is checked so I can type in comments only when the checkbox is checked.

    Was this answer helpful?

    0 comments No comments
  2. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2016-10-27T23:46:32+00:00

    If you use an ActiveX checkbox and have a { DOCVARIABLE Comment } field where you want the comment to appear and have the following code for the checkbox

    Private Sub CheckBox1_Click()

    With ActiveDocument

        With .Variables("Comment")

            If CheckBox1.Value = True Then

                .Value = "This is the comment that you wanted to see."

            Else

                .Value = " "

            End If

        End With

        .Range.Fields.Update

    End With

    End Sub

    When the checkbox is checked, the docvariable field will display

    and when it is unchecked, it will display just an empty space

    Was this answer helpful?

    0 comments No comments