View Single Post
 
Old 12-12-2022, 07:38 AM
Strange Strange is offline Windows 10 Office 2019
Novice
 
Join Date: Dec 2022
Posts: 3
Strange is on a distinguished road
Default Hide a bookmark with a ContentControlCheckBox

Hello,
I am new to MS VBA and i have a very special Question.
I am trying to hide a bookmarked text with a ContentControlCheckBox.

I tried this code:

Code:
Private Sub Document_ContentControlBeforeContentUpdate(ByVal ContentControl As ContentControl, Content As String)
      If ContentControl.Tag = "Checkbox1" Then
      If Content = "true" Then ActiveDocument.Bookmarks("Test1").Range.Font.Hidden = True
      If Content = "false" Then ActiveDocument.Bookmarks("Test1").Range.Font.Hidden = False
    End If
End Sub
But i just get an error message: Runtime error 6197: This object model error is not available in the current event.

What am i doing wrong? Can somebody help me with this?
Reply With Quote