View all Word Bookmarks on page


Is there a way to view all the Word Bookmark names at their respective locations at once?

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can view the start and end of all bookmarks in the document or you can use GoTo to select an individual bookmark.

There is no built-in method for displaying bookmark names in the document.
Unfortunately, Word does not provide an automatic method of printing bookmarks, as it does with other document-related information. The quickest way to print a bookmark list is to just insert the list in your document and then print it. The following VBA macro inserts the bookmark list at the insertion point:
Sub BkMarkList()
    Dim J as Integer

    Selection.InsertBreak Type:=wdColumnBreak
    Selection.TypeText Text:="Bookmark list for "
    Selection.TypeText Text:=ActiveDocument.Name
    For J = 1 To ActiveDocument.Bookmarks.Count
        Selection.TypeText Text:=Chr(9)
        Selection.TypeText Text:=ActiveDocument.Bookmarks(J).Name
    Next J
    Selection.InsertBreak Type:=wdColumnBreak
End Sub
When you run the macro, a heading indicating the name of the file will be inserted, followed by each bookmark in the file. These will be in alphabetic order. The bookmark list has a column break before it and after it, as well.

In a similar vein, you could insert the bookmark names in distinctively formatted text. The distinctive format will make the names stand out and will also make them easy to remove.

The following macro will add the names after the bookmarks,
Sub FlagBookmarks()
Dim bmk As Bookmark
Dim rng As Range

For Each bmk In ActiveDocument.Bookmarks
    Set rng = bmk.Range
    rng.Collapse wdCollapseEnd
    rng.Text = bmk.Name
    rng.Font.Superscript = True
    rng.Font.Color = wdColorRed
Next bmk
End Sub

Open in new window

And this will remove them
Sub UnFlagBookmarks()
With ActiveDocument.Range.Find
    .Font.Superscript = True
    .Font.Color = wdColorRed
    .Execute Replace:=wdReplaceAll
End With
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.