Thursday, 20 February 2014

How to remove single or all bookmarks from a Word document

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. word-icon-256x256

It would have taken a long time (or more time than I would like to spend) removing them one by one so I looked for a method of removing them all in one shot.

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.
clip_image001
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.
clip_image002
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.
clip_image001[1]
You will see your list of bookmarks
clip_image003
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.
clip_image004
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 Runclip_image006 button or press F5 to apply VBA directly and then close the window.
clip_image008
6. When you view the Bookmarks again you will see they have all been removed.
clip_image009



























1 comment:

  1. Your delete all solution worked perfectly. Thanks.

    ReplyDelete