Removing Unused Bookmarks

A

Armando Szapiro

Is there any procedure or macro to remove unused or/and unreferenced
bookmarks? I have a lot of them in some documents and I need to "clear" them
before translating.
--
Armando Szapiro
HaBotzrim 22/5
75498 - Rishon Letzion - Israel
+972 3 941 4439
0524 201 333
 
A

Armando Szapiro

I programmed the next Macro and works fine.

Sub ClearBookmarks()
'
' ClearBookmarks Macro
' Macro grabada el 01/12/2004 por Armando Szapiro
'
Dim intNumBookmarks As Integer
intNumBookmarks = ActiveDocument.Bookmarks.Count
Dim ToDelete(intNumBookmarks)
ActiveWindow.View.ShowFieldCodes = True

For i = 1 To intNumBookmarks
nombre = ActiveDocument.Bookmarks(i).Name

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = nombre
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Not Selection.Find.Execute Then
d = d + 1
ToDelete(d) = nombre
End If
Next i
If d > 0 Then
For i = d To 1 Step -1

ActiveDocument.Bookmarks(ToDelete(i)).Delete

Next i
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top