2 Quick Ways to Batch Delete Multiple Bookmarks in Your Word Document

In this article, we want to provide you with two quick ways to batch delete multiple bookmarks in your Word document.

Normally you can add or delete a single bookmark in Word document without any obstacle. However, when it comes to multiple bookmarks, you may feel your hands are tied.

Fortunately, there is a powerful tool in Word that is the VBA editor. Therefore, we will use macros to help you batch remove multiple bookmarks in a document.Batch Delete Multiple Bookmarks in Your Word Document

Method 1: Batch Delete All Bookmarks in a Document

  1. First and foremost, invoke the VBA editor in Word by pressing “Alt+ F11”.
  2. Next on the left “Project” panel, click on “Normal”.
  3. Then click “Insert” tab and choose “Module” on its menu.Click "Normal"->Click "Insert"->Click "Module"
  4. Double click to open module.
  5. Now paste following codes there:
Sub DeleteAllBookmarksInDoc()
  Dim objBookmark As Bookmark
  Dim nBookmark As Integer
  Dim strButtonValue As String
  Dim objDoc As Document
 
  Application.ScreenUpdating = False
 
  Set objDoc = ActiveDocument
  nBookmark = objDoc.Bookmarks.Count
  If nBookmark > 0 Then
    strButtonValue = MsgBox("Do you want to remove all " & nBookmark & " bookmark(s) in this document?", vbYesNo)
    If strButtonValue = vbYes Then
      For Each objBookmark In objDoc.Bookmarks
        objBookmark.Delete
      Next objBookmark
      MsgBox ("All bookmarks in this document have been deleted.")
    Else
      Exit Sub
    End If
  End If
 
  Application.ScreenUpdating = True
End Sub
  1. Then click “Run” button.Paste Codes->Click "Run"
  2. Next you will get an asking box. And you can see the total number of bookmarks in current document. Click “Yes” to delete them all, or “No” to exit macro.Click to Choose to Run the Macro or Exit It
  3. If you choose “Yes”, you shall receive a message such as below:Message Indicating Operation is done

Method 2: Batch Delete All Bookmarks in a Selection

Admittedly, there are also times when you have to remove several bookmarks but keep some intact. Similarly, we will run a macro on a selection to get the job done.

  1. To start off, repeat above steps to install and run a macro.
  2. Remember to replace macro with this one:
Sub DeleteAllBookmarksInSelection()
  Dim objBookmark As Bookmark
  Dim nBookmark As Integer
  Dim strButtonValue As String
 
  Application.ScreenUpdating = False
 
  nBookmark = Selection.Bookmarks.Count
  If nBookmark > 0 Then
    strButtonValue = MsgBox("Do you want to remove all " & nBookmark & " bookmark(s) in this selection?", vbYesNo)
    If strButtonValue = vbYes Then
      For Each objBookmark In Selection.Bookmarks
        objBookmark.Delete
      Next objBookmark
      MsgBox ("All " & nBookmark & " bookmark(s) in this selection have been deleted.")
    Else
      Exit Sub
    End If
  End If
 
  Application.ScreenUpdating = True
End Sub
  1. Before running the macro, you shall make a selection over a range of contents.
  2. And in the process of executing codes, you shall receive the same 2 message boxes shown in method 1.

The result is you will only have bookmarks in the selection removed.

Get Ready for Document Corruption

Data loss can happen to anyone anytime. And its unpredictability makes us take a chance on not running into the bad luck. Speaking of the topic to repair docx, you can never miss picking an efficient repairing tool in advance.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls repair and pdf repair software products. For more information visit www.datanumen.com

One response to “2 Quick Ways to Batch Delete Multiple Bookmarks in Your Word Document”

  1. I don’t even understand how I finished up right here,
    but I assumed this submit was once great.
    I don’t understand who you are but certainly you’re going to a well-known blogger for those who aren’t already.
    Cheers!