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.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Naturesk Profile
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 47 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WORD] Clear (Empty) Bookmarks from ActiveDocument [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
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;
Credits to Graham Mayor


pus acum 3 ani
   
Pagini: 1  

Mergi la