The Fast Way to Delete Hidden Bookmarks in MS Word

October 10, 2021

Smashwords is one of many platforms for authors to self-publish books. As with other platforms, publishers are required to follow a style guide to ensure their manuscript can be properly converted to various eBook formats.

At the time of this writing, the most recent revision to the style guide was in 2014, and Step 20d recommends removing hidden bookmarks that Microsoft Word tends to insert into documents:


After you’ve completed your testing, do this step last. Word has the bad habit of inserting “Hidden” bookmarks into your document, and in some cases these hidden bookmarks can corrupt your NCX. Once you’re finished hyperlinking the guts of your book, and testing the accuracy of your links, check for and delete hidden bookmarks. To find them, click Insert: Bookmark, then try clicking and unclicking the checkbox beside “Hidden Bookmarks.” Hidden bookmarks start with an underline, such as, “_Hlt29XXXX” Click the name of the hidden bookmark, which always look like gibberish, then click the Delete button at right. You might have dozens or hundreds of them. Delete them one by one by clicking once to the hidden bookmark, then click on Delete. Then repeat. See screen shot below.

I’m sure I’m not alone in finding (what looks like) 100+ hidden bookmarks:

A list of hidden bookmarks in a Bookmark dialog box.

So, the style guide suggests clicking on a bookmark, then clicking Delete, and repeating for each one.

Unfortunately, MS Word does not offer a way to delete multiple bookmarks at once either.

I don’t know about you, but manually deleting each hidden bookmark one at a time sounds horrendously painful (on the wrists), tedious, and time-consuming.

Fortunately, after some thinking, research, and tinkering, I devised a solution that will only take a couple minutes of your time and spare you from mind-numbing drudgery.

Along the top of the MS Word menu bar, you may or may not see a Developer tab:


If you see it, click on it; otherwise, click on File on the left, then click Options:


Click on Customize Ribbon on the left sidebar. Next, scroll down the list on the right until you see Developer, then check the box next to it. Click Ok to exit the screen, and you should now have a Developer tab along the top menu bar. Click on it.


Click on Visual Basic on the left:


Right-click on the “project” with your document name, mouse over Insert, then click on Module:


Paste the following code in the window that pops up:

Sub removebookmarks()
 Dim bkm As Bookmark
 For Each bkm In ActiveDocument.Bookmarks
  If bkm Like “_*” Then
  End If
 Next bkm
End Sub


Basically, this code will go through all the bookmarks in your document and delete those that start with an underscore (_), as those are the hidden bookmarks.

Among the top menu bars, you’ll see a “run” button. Click on it:


In the window that pops up, select removebookmarks if it isn’t already selected, then click Run:


The hidden bookmarks are, now, deleted, so you can exit the Visual Basic editor by going to File, then Close and Return to Microsoft Word:


If you return to the Bookmark window, you should no longer see any hidden bookmarks:


Just before writing up this post, I did some searching and found that Terry Odell presented a similar solution. Either solution will help you save precious time, and needless, incessant clicking. I just thought I’d share a solution here to spread the word — at least until the (now) seven-year-old style guide is updated.

Happy publishing!

© 2023, Alvin Tsui