View Single Post
 
Old 11-30-2017, 01:30 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,373
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by namrehx View Post
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
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote