Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Printing a Bookmark List.

Printing a Bookmark List

by Allen Wyatt
(last updated January 3, 2015)

8

Word provides a very powerful bookmark facility that allows you to assign names to either individual positions in your document or to text selections. As you work more with Word, and particularly in long documents, it would be helpful to periodically print a list of bookmarks. 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.TypeParagraph
    Selection.InsertBreak Type:=wdColumnBreak
    Selection.TypeText Text:="Bookmark list for "
    Selection.TypeText Text:=ActiveDocument.Name
    Selection.TypeParagraph
    For J = 1 To ActiveDocument.Bookmarks.Count
        Selection.TypeText Text:=Chr(9)
        Selection.TypeText Text:=ActiveDocument.Bookmarks(J).Name
        Selection.TypeParagraph
    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. You can then print out the single page that contains the bookmark list. When you are done printing, you can delete the bookmark list.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8880) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Printing a Bookmark List.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Displaying an Input Format in a Cell

Want to show a user, in a cell, what you expect their input to look like? Unfortuantely it cannot be done natively in Excel. ...

Discover More

Adjusting Times for Time Zones

Collect a series of times in a worksheet, and you might need to adjust those times for various time zones. This involves a ...

Discover More

Copying Formats

Want to copy a format from one place to another without taking your hands off the keyboard? It's easy to do if you apply the ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Protecting Bookmarks

Bookmarks are a great boon in developing and working with documents—until someone deletes them. When it comes to ...

Discover More

Determining the Number of Bookmarks Defined in a Document

If you develop a macro that needs to work with bookmarks defined in a document, it is inevitable that you will need a way to ...

Discover More

Understanding and Using Bookmarks

Bookmarks are a great feature you can use to mark the location of text or to mark a position within a document. They can be ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three more than 5?

2015-08-23 21:03:16

awyatt

Sandy: Yes, that would be good takeaway.

-Allen


2015-08-23 16:16:37

Sandy Deja

My takeaway from this is that I cannot do it if I do not know how to do a VBA macro. Correct?


2015-07-27 11:11:17

Lisa

By the way, this is the GetFolder I was trying to use:

Get Folder:
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function


2015-07-27 11:09:36

Lisa

Can you adjust this to scan an entire folder of Word docs? I have a GetFolder I can use, but I'm not sure how to add this together to get the names of all the bookmarks in all the files in the folder. Any help would be GREATLY appreciated!! Thank you!


2015-02-15 21:07:59

Mike

I ended up creating a script that prints the bookmark name alongside the bookmarked text with the code below:

Sub NewBrackets()
Dim i As Long
Dim strBookmark As String

With ActiveDocument
For i = 1 To .Bookmarks.Count
strBookmark = .Bookmarks(i).Name
With .Bookmarks(i).Range
.InsertBefore "["
.InsertAfter "]("
.InsertAfter strBookmark
.InsertAfter ")"
End With
Next i
End With
End Sub

--
I also like Ken's solution too!


2015-02-14 06:19:25

Ken Endacott

The following macro will in the body of the document, highlight bookmarked text in blue followed by the bookmark name in red.

Sub ShowBookmarks()
Dim j As Long
Dim BMark As Bookmark
Dim aRange As Range
For Each BMark In ActiveDocument.Bookmarks
With BMark
If Left(.Name, 1) <> "_" Then
.Range.Font.ColorIndex = wdBlue
.Range.Select
Selection.Collapse direction:=wdCollapseEnd
Selection.Font.ColorIndex = wdRed
Selection.TypeText " " & .Name
End If
End With
Next BMark
End Sub


2015-02-13 13:52:01

Mike

How would you modify this so that it prints the bookmark name alongside the bookmarked text?


2015-01-03 06:30:09

Ken Endacott

The macro will also list normally hidden system generated bookmarks that have an underscore character in the first character of the name. Listing the system bookmarks can be confusing because whenever a Table of Contents is replaced a new set of heading bookmarks is created but the old ones are not deleted. It is possible to end up with hundreds of unused system bookmarks in a heavily edited document.

Also, it may be useful to print alongside the bookmark name, the bookmarked text.

The following version of the macro will ignore system generated bookmarks and print the bookmarked text after the bookmark name. If you don't want the bookmarked text then remove the marked statement.

Sub BkMarkList()
Dim J As Integer

Selection.TypeParagraph
Selection.InsertBreak Type:=wdColumnBreak
Selection.TypeText Text:="Bookmark list for "
Selection.TypeText Text:=ActiveDocument.Name
Selection.TypeParagraph
For J = 1 To ActiveDocument.Bookmarks.Count
With ActiveDocument.Bookmarks(J)
If Left(.Name, 1) <> "_" Then
Selection.TypeText Text:=Chr(9)
Selection.TypeText Text:=.Name
' ******* the following line adds the bookmarked text *******
Selection.TypeText Text:=" Text= " & .Range.Text
Selection.TypeParagraph
End If
End With
Next J
Selection.InsertBreak Type:=wdColumnBreak
End Sub


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.