Printing with bookmarks

  • Thread starter Thread starter Sandra
  • Start date Start date
S

Sandra

I want to print a document and have it show all of the
bookmarks I've inserted and where I placed them. Can I do
this? I'm having problems with a program I'm writing and
want to check the bookmarks, but I cannot ever actually
SEE where the bookmarks are! Thanks,

Sandra
 
Hi Sandra,

You can see where bookmarks are (though not by name) by turning on the
'bookmarks' option under Tools|Options|View.

Here's another way of approaching the problem: the following macro generates
a list of all bookmarks at the end of the active document, and displays
their contents:

Sub ListBkMrks()
Dim BkMrk As Bookmark
If ActiveDocument.Bookmarks.Count > 0 Then
For Each BkMrk In ActiveDocument.Bookmarks
With Selection
.EndKey Unit:=wdStory
.InsertAfter BkMrk.Name & " "
.EndKey Unit:=wdStory
BkMrk = ActiveDocument.Fields.Add(Range:=Selection.Range, _
Text:= BkMrk.Name, PreserveFormatting:=False)
.InsertAfter vbCrLf
End With
Next BkMrk
End If
End Sub

You might find this easier to work with than inserting the bookmark names
throughout the document; with the results at the end, it's easy to see both
and a word search will soon turn them up. It's also much easier to delete
them if you need to.

Cheers
 
Back
Top