View Single Post
 
Old 11-02-2023, 02:42 PM
KSmart KSmart is offline Windows 10 Office 2021
Novice
 
Join Date: Nov 2023
Posts: 3
KSmart is on a distinguished road
Default VBA to show/hide checkboxes- always showing bookmark

Hello-

I have a VBA code to show a bookmark based on the checkbox being selected, however, every time I load the word template all of the bookmarks under one section are showing unless I select/unselect them before I get started on filling out the document. The checkboxes are in a straight line across my word document. There are times where 1 option is selected and other times where all could be selected. My VBA code is

Private Sub CheckBox6_Click()
ActiveDocument.Bookmarks("LT").Range.Font.Hidden = Not CheckBox6.Value
End Sub

Private Sub CheckBox9_Click()
ActiveDocument.Bookmarks("MT").Range.Font.Hidden = Not CheckBox9.Value
End Sub

Private Sub CheckBox10_Click()
ActiveDocument.Bookmarks("HT").Range.Font.Hidden = Not CheckBox10.Value
End Sub

Private Sub CheckBox11_Click()
ActiveDocument.Bookmarks("XHT").Range.Font.Hidden = Not CheckBox11.Value
End Sub

Private Sub CheckBox12_Click()
ActiveDocument.Bookmarks("XHTT").Range.Font.Hidden = Not CheckBox12.Value
End Sub

Private Sub CheckBox13_Click()
ActiveDocument.Bookmarks("PP").Range.Font.Hidden = Not CheckBox13.Value
End Sub

Private Sub CheckBox14_Click()
ActiveDocument.Bookmarks("T").Range.Font.Hidden = Not CheckBox14.Value
End Sub

What am I doing wrong?
Reply With Quote