Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-30-2017, 01:30 PM
macropod's Avatar
macropod macropod is offline How to use checkbox to show/hide bookmarked text? Windows 7 64bit How to use checkbox to show/hide bookmarked text? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,513
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide rows with checkbox gebobs Excel 3 03-24-2015 12:05 PM
Show/hide text macro and security issues? subspace3 Word VBA 1 10-05-2014 10:05 AM
How to use checkbox to show/hide bookmarked text? Show/Hide Text based on Checkbox Selection tammytran105 Word VBA 7 10-02-2014 04:30 PM
How to use checkbox to show/hide bookmarked text? Hide Checkbox When Printing vinceplunkett Word 1 12-03-2013 01:53 AM
How to use checkbox to show/hide bookmarked text? VBA for CheckBox to Hide Slides mutchy25 PowerPoint 1 09-21-2012 01:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft