Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Word Newsgroups
Word VBA
A macro to eliminate bookmarks within a block of selected text?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Lene Fredborg, post: 5879547"] ....and if you still want a macro: The following macro will delete all bookmarks in the selection, incl. hidden bookmarks (such as _Ref bookmarks). Sub DeleteBookmarksInSelection() Dim oBookmark As Bookmark Dim bShowHidden As Boolean 'Save status of "Show Hidden" bookmarks bShowHidden = ActiveDocument.Bookmarks.ShowHidden 'Make sure to also delete hidden bookmarks ActiveDocument.Bookmarks.ShowHidden = True For Each oBookmark In Selection.Bookmarks oBookmark.Delete Next oBookmark 'Set "Show hidden" back to initial state ActiveDocument.Bookmarks.ShowHidden = bShowHidden End Sub If you need help on installing a macro, see: [URL]http://www.gmayor.com/installing_macro.htm[/URL] If you want to keep hidden bookmarks, delete the line: ActiveDocument.Bookmarks.ShowHidden = True In that case, you can also delete all lines in which bShowHidden is found. -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark [URL="http://www.thedoctools.com"]www.thedoctools.com[/URL] Document automation - add-ins, macros and templates for Microsoft Word [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Word Newsgroups
Word VBA
A macro to eliminate bookmarks within a block of selected text?
Top