Checkbox - toggle hide/unhide other checkboxes and their texts
Hello,
I am new to VBA and I'm trying to create an document with 3 checkboxes, where each of them shows a specific text when checked, I managed this with bookmarking the text. But I would also like to hide the other 2 checkboxes when one checkbox is checked, is this possible? And I would also like them to appear again if I uncheck the box.
Here is the VBA code I've used so far, I also attach the document:
Private Sub CheckBox1_Click()
ClickEvent CheckBox1
End Sub
Private Sub CheckBox2_Click()
ClickEvent CheckBox2
End Sub
Private Sub CheckBox3_Click()
ClickEvent CheckBox3
End Sub
Private Sub ClickEvent(ctrl As msforms.CheckBox)
Dim sBookmarkName As String
With ThisDocument
Select Case ctrl.Name
Case "CheckBox1": sBookmarkName = "TextToHide"
Case "CheckBox2": sBookmarkName = "TextToHide2"
Case "CheckBox3": sBookmarkName = "TextToHide3"
End Select
.Bookmarks(sBookmarkName).Range.Font.Hidden = _
Not ctrl.Value
End With
End Sub
|