Whilst in the process of consolidating several documents (via copy/paste) I realised I had a huge number of unwanted bookmarks in my final document. |
As you may not need to remove all of the bookmarks and would like to retain some, I have also included some instructions for removing bookmarks on an individual basis.
Manually remove single bookmarks
If you have a few bookmarks that you wish to remove, you can manually remove them one at a time.
Here’s how it’s done.
1. Open word and go to the Insert tab on the ribbon and select Bookmark.
2. All of the bookmarks contained in the current document will be listed in the Bookmark window. This list can be ordered by name or location. It should be noted that you cannot select more than one bookmark so if you want to delete all bookmarks, please see the instructions later on in this post.
3. Select the bookmark you wish to remove and click the Delete button.
Remove all bookmarks in a document using VBA
Some documents can contain many (even hundreds) of bookmarks so it would be very laborious to remove them one by one. Thankfully they can all be removed in one go using VBA (Visual Basic for Applications) code.
Here is how it’s done.
1. Open the word document which contains the bookmarks.
2. To view your bookmarks go to the Insert tab on the ribbon and select Bookmark.
You will see your list of bookmarks
Close this window by clicking the X (top right) or the Cancel button.
2. Press Alt+F11 to open the Microsoft Visual Basic for Applications window
3. Click Module from the insert tab.
4. Insert the following VBA code in the Module Window
Sub removebookmarks()
Dim bkm As Bookmark
For Each bkm In ActiveDocument.Bookmarks
bkm.Delete
Next bkm
End Sub
5. Click Run button or press F5 to apply VBA directly and then close the window.
6. When you view the Bookmarks again you will see they have all been removed.
Your delete all solution worked perfectly. Thanks.
ReplyDelete