Bookmarks

J

Jake

Is it possible to have bookmark names displayed in a document? I know you
can show them with a placeholder, but I'd like to display the name. I've
tried the style view, no luck. Any help much appreciated.
 
J

Jay Freedman

Hi, Jake,

There isn't anything built in, like the style area you mentioned. If
you put the names directly into the text, they would disrupt the text
layout.

The solution I use is to put this macro into a global template, and
assign a new item on the right-click menu to run it. If the cursor is
in a bookmark, a message box pops up with its name. It helps to have
the placeholders turned on (Tools > Options > View > Bookmarks) so you
know where to right-click.

Sub WhatBookmark()
Dim bk As Bookmark
For Each bk In ActiveDocument.Bookmarks
If Selection.InRange(bk.Range) Then
MsgBox bk.Name, vbOKOnly, "What Bookmark"
Exit Sub
End If
Next bk
MsgBox "Not in a bookmark", vbOKOnly, "What Bookmark"
End Sub
 
Top