Bookmarks

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Is there a way to print out a list of bookmarks in a
template? I need to use these names in a VBA application
I'm writing, and the template I'm using has a lot of
bookmarks that I need to reference in the program.
 
Hi Lee,

The following macro types the name of each bookmark in the
document, immediately after the bookmark. Only caution is
to never run this macro on the document itself, but rather
on a copy that can be discarded - helpful while working
with the template document's code.

This should get you started:

Sub ListBkMrks()
Dim aBmk As Bookmark
Dim strBmkName As String
If Documents.Count > 0 Then
For Each aBmk In ActiveDocument.Bookmarks
strBmkName = strBmkName & vbcrlf & _
aBmk.Name
Next aBmk
End If
MsgBox strBmkName
End Sub

Replace the MsgBox with your preferred output method.

Cheers
PS: Remove NO.SPAM from the above before replying.
 
Back
Top