View Single Post
  #2   Report Post  
Armando Szapiro
 
Posts: n/a
Default

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




"Armando Szapiro" escribió en el mensaje
...
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