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

Printing a Bookmark List

Written by Allen Wyatt (last updated August 4, 2022)
This tip applies to Word 97, 2000, 2002, and 2003


2

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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1019) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) 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

Formula Shows Instead of Formula Result

When you enter a formula in a cell, you expect Excel to display the result of that formula once you are completed. If ...

Discover More

Calculating Dates with Fields

Can you calculate dates using fields? Yes, but you probably don't want to except as a learning experience. An easier way ...

Discover More

Comma-Delimited and MS-DOS CSV Variations

Excel provides different file formats you can use to export your worksheet information. One such file format is CSV, or ...

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 (menu)

Seeing Where Bookmarks Are

Bookmarks can be great for referencing and finding portions of your document. If you want to easily see where the ...

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 ...

Discover More

Making Bookmarks Bold

Do you want an easy way to see all the bookmarks in your document? Word provides a way to make them visible, or you can ...

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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 2 + 2?

2017-12-13 23:40:46

jamal

I have a code in Word that extracts all references in the document in a table showing its name, page number, and line.
This is the code:
Sub ListBkMrks()
Application.ScreenUpdating = False
Dim oBkMrk As Bookmark, rng As Range, StrTxt As String, StrStory As String
With ActiveDocument
Set rng = .Range.Characters.Last
If .Bookmarks.Count > 0 Then
With rng
.Text = vbCrLf & "Bookmark" & vbTab & "Page" & vbTab & "Line" & vbTab & "Story Range" & vbTab & "Contents"
For Each oBkMrk In ActiveDocument.Bookmarks
.InsertAfter vbCrLf & oBkMrk.Name & vbTab
.InsertAfter oBkMrk.Range.Characters.First.Information(wdActiveEndAdjustedPageNumber)
.InsertAfter vbTab & oBkMrk.Range.Information(wdFirstCharacterLineNumber)
Select Case oBkMrk.StoryType
Case 1: StrStory = "Main text"
Case 2: StrStory = "Footnotes"
Case 3: StrStory = "Endnotes"
Case 4: StrStory = "Comments"
Case 5: StrStory = "Text frame"
Case 6: StrStory = "Even pages header"
Case 7: StrStory = "Primary header"
Case 8: StrStory = "Even pages footer"
Case 9: StrStory = "Primary footer"
Case 10: StrStory = "First page header"
Case 11: StrStory = "First page footer"
Case 12: StrStory = "Footnote separator"
Case 13: StrStory = "Footnote continuation separator"
Case 14: StrStory = "Footnote continuation notice"
Case 15: StrStory = "Endnote separator"
Case 16: StrStory = "Endnote continuation separator"
Case 17: StrStory = "Endnote continuation notice"
Case Else: StrStory = "Unknown"
End Select
.InsertAfter vbTab & StrStory & vbTab & oBkMrk.Range.Text
Next oBkMrk
.Start = .Start + 1
.ConvertToTable Separator:=vbTab
.Tables(1).Rows.First.Range.Font.Bold = True
'.Copy
End With
End If
End With
Set rng = Nothing
Application.ScreenUpdating = True
End Sub
I just want a code to make this code copy all references from this document with the same name and same page number, and the same number of lines in another document


2016-03-20 13:10:16

Jim Walton

If you need the list in location order rather than alphabetical order, here is a quick fix:

Change:
Selection.TypeText Text:=ActiveDocument.Bookmarks(J).Name
To:
Selection.TypeText Text:=ActiveDocument.Range.Bookmarks(J).Name

This works for Word 2016.


This Site

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

Videos
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.