Written by Allen Wyatt (last updated September 26, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365
Eric has a document that has many bookmarks that were either created by Word itself or are remnants of previous bookmarks no longer needed. He wonders if there is a quick way to delete all the unused bookmarks in the document.
The answer depends on what is meant by "unused." In general, there are two ways you could possibly determine if a bookmark is unused or not. If the bookmark is not the target of a cross-reference, then you might consider it unused. If the bookmark is "empty," meaning it doesn't contain text, you might also consider it unused.
Notice that in these two measures, I used the term "might." That was deliberate, because you could have empty bookmarks that have a use—you might use them to jump to locations within your document, for instance. In that case, calling an empty bookmark "unused" would be a misnomer.
The same could be said about bookmarks that aren't targets of cross-references. You might, again, have them defined to mark places to which you want to jump or text that you might way to reference in a macro or text that will be referenced by some other type of field.
When it comes to bookmarks created by Word—generally referred to as "system bookmarks"—things get even murkier. Word routinely creates bookmarks for use by many fields. The names of these system bookmarks begin with an underscore, and bookmarks whose names begin with underscores are considered "hidden" by Word. So, these system bookmarks are normally maintained in the background, out of sight. But, they are there, and they may serve a purpose, even a purpose that may be hard to discern.
Let's say, though, that you decide you do want to delete all the empty bookmarks and all the system bookmarks defined in your document. The easiest way to do this is to use a macro, such as the following:
Sub DeleteUnusedBookmarks1() Dim bm As Bookmark Dim J As Integer Dim C1 As Integer Dim C2 As Integer Dim sMsg As String C1 = ActiveDocument.Bookmarks.Count For J = ActiveDocument.Bookmarks.Count To 1 Step -1 Set bm = ActiveDocument.Bookmarks(J) ' Delete if bookmark is empty or system-generated If bm.Range.Start = bm.Range.End Or Left(bm.Name, 1) = "_" Then bm.Delete Next J C2 = ActiveDocument.Bookmarks.Count sMsg = "There were originally " & C1 & " bookmarks, " sMsg = sMsg & "and " & C1-C2 & " unreferenced bookmarks " sMsg = sMsg & "have been deleted. " sMsg = sMsg & "There are " C2 & " bookmarks remaining." MsgBox sMsg, vbInformation End Sub
The macro steps through all bookmarks and, if the bookmark is empty (it doesn't refer to a range of text) or its name begins with an underscore, it is deleted. When done, you'll see a message about how many bookmarks were deleted.
If you want to get just a bit more selective and delete only system bookmarks and those that are not referenced anywhere in your document, then the macro needs to be a bit longer:
Sub DeleteUnusedBookmarks2() Dim bm As Bookmark Dim C1 As Integer Dim C2 As Integer Dim bname As String Dim found_it As Boolean Dim sMsg As String Dim sfc As Boolean ' Remember whether field codes are shown or not sfc = ActiveWindow.View.ShowFieldCodes ' Show field codes, so that their code string ' is available to Find ActiveWindow.View.ShowFieldCodes = True C1 = ActiveDocument.Bookmarks.Count For Each bm In ActiveDocument.Bookmarks bname = bm.Name If Left(bname, 1) = "_" Then ' System-generated bookmark bm.Delete Else ' Start search at beginning of document ActiveDocument.Range(0, 0).Select With Selection.Find .Text = bname .Execute found_it = .Found End With If found_it = False Then bm.Delete End If Next bm C2 = ActiveDocument.Bookmarks.Count ActiveWindow.View.ShowFieldCodes = sfc sMsg = "There were originally " & C1 & " bookmarks, " sMsg = sMsg & "and " & C1-C2 & " unreferenced bookmarks " sMsg = sMsg & "have been deleted. " sMsg = sMsg & "There are " C2 & " bookmarks remaining." MsgBox sMsg, vbInformation End Sub
In this case the macro turns on the display of field codes so that Find and Replace can be used to locate text within the codes. This allows the macro to find whether a bookmark name is used in any of the field codes. If it is not used in any field codes, then the bookmark is deleted. The bookmark is also deleted if its name begins with an underscore. Upon completion, a recap of what was deleted is also presented.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13958) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!
Bookmarks in Word are just like bookmarks used in paper books, any given bookmark may be reused to mark a new location. ...
Discover MoreWhen you do a search and replace operation in Word, it is possible that you could inadvertently wipe out a bookmark or ...
Discover MoreBookmarks can be a great tool in Word, allowing you to easily remember the location of desired blocks of text. If you ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments