Quote:
Originally Posted by namrehx
How can i get a multiple bookmarks to hide/appear when I check/uncheck a checkbox?
|
That's as simple as referencing more bookmarks in the same macro. For example:
Code:
Private Sub CheckBox1_Click()
ActiveDocument.Bookmarks("Bookmark1").Range.Font.Hidden = CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark2").Range.Font.Hidden = CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark3").Range.Font.Hidden = CheckBox1.Value
End Sub
You can even invert the action, so the hidden state is opposite whatever the checkbox state is:
Code:
Private Sub CheckBox1_Click()
ActiveDocument.Bookmarks("Bookmark1").Range.Font.Hidden = Not CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark2").Range.Font.Hidden = Not CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark3").Range.Font.Hidden = Not CheckBox1.Value
End Sub
and you can mix the two together:
Code:
Private Sub CheckBox1_Click()
ActiveDocument.Bookmarks("Bookmark1").Range.Font.Hidden = CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark2").Range.Font.Hidden = CheckBox1.Value
ActiveDocument.Bookmarks("Bookmark3").Range.Font.Hidden = Not CheckBox1.Value
End Sub