View Single Post
 
Old 08-14-2022, 03:12 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Somewhat simpler:
Code:
Sub KillAllBookmarks()
With ActiveDocument
  Do While .Bookmarks.Count > 0
     .Bookmarks(1).Delete
  Loop
End With
End Sub
and, if you only want to delete hidden bookmarks, more reliably:
Code:
Sub KillHiddenBookmarks()
Dim i As Long, bHid As Boolean
With ActiveDocument
  bHid = .Bookmarks.ShowHidden
  .Bookmarks.ShowHidden = True
  For i = .Bookmarks.Count To 1 Step -1
     With .Bookmarks(i)
      If Left(.Name, 1) = "_" Then .Delete
     End With
  Next
  .Bookmarks.ShowHidden = bHid
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote