Simpatie.ro - matrimoniale
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
LaraTaner 24 ani
Femeie
24 ani
Prahova
cauta Barbat
24 - 52 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[WORD] Clear (Empty) Bookmarks from ActiveDocument [VBA]

Pagini: 1 Moderat de TRaP, TonyTzu
#1
TRaP
Moderator
Postari: 960
The code below removes the data inside all bookmarks in the current Word document.
It does not remove the bookmarks themselves.



Sub ClearBookmarks()
Dim i As Long
Dim strName As String

For i = 1 To ActiveDocument.Bookmarks.Count
    strName = ActiveDocument.Bookmarks(i).Name
    FillBM strName, ""
Next i

lbl_Exit:
Exit Sub
End Sub

Private Sub FillBM(strBMName As String, strValue As String)
Dim oRng As Range

With ActiveDocument
    On Error GoTo lbl_Exit
    Set oRng = .Bookmarks(strBMName).Range
    oRng.Text = strValue
    oRng.Bookmarks.Add strBMName
End With

lbl_Exit:
Set oRng = Nothing
Exit Sub

End Sub


Source; http://www.vbaexpress.com/forum/archive ... 53421.html
Credits to Graham Mayor


 
   
Pagini: 1  
Mergi la