Thread: [Solved] Macro for creating bookmarks
View Single Post
 
Old 07-13-2025, 04:27 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
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

Hi Susan,

In my code, the Style to search for is defined in the line:
.Style = "myStyle"

With Word's Find.Execute method, the found range automatically becomes the active range. And, when the Bookmarks.Add method is invoked without specifying the range to bookmark, it bookmarks the active range. I could have added .Duplicate as the optional Range parameter, but that would have been redundant.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote