View Single Post
 
Old 11-06-2023, 04:56 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,166
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Hmm, bookmarks can only exist once in a document so you can't bookmark the second region with the same bookmark name. You could append a digit to the related bookmarks and adjust the code to also look for extra digits in the bookmark name.

Alternately, you could move away from the bookmark method of tagging areas for hiding and use other content controls for this purpose. The benefit of using Content Controls for your tagging is that you can loop through CCs which share an attribute like Tag or Title. For example
Code:
  Dim aCC As ContentControl
  For Each aCC In ActiveDocument.SelectContentControlsByTag("Hi")
    aCC.Range.Font.Hidden = True
  Next aCC
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote