Inserting the Line Number of a Bookmark

Written by Allen Wyatt (last updated April 19, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365


Hasan has a document that includes a bookmark. He wonders if there is a field he can use to indicate the line number on which the bookmark occurs.

The short answer is no, there is not a way to do this in Word. You can obviously turn on line numbering, jump to the bookmark, and note the line number on which it occurs. Since Hasan wants a field to indicate this line number, though, it seems like he ways a way to reference that line number elsewhere.

A field would be helpful to do this, but since none exists, you need to rely on a workaround using a macro. Here's a simple macro that could do the trick:

Sub TypeBookmarkLineNumber()
    Dim bm As Bookmark
    Dim bmRange As Range
    Dim lineNumber As Long

    Set bm = ActiveDocument.Bookmarks("MBN")
    Set bmRange = bm.Range
    lineNumber = bmRange.Information(wdFirstCharacterLineNumber)

    Selection.TypeText lineNumber & " "
End Sub

This macro assumes a couple of things. First, it assumes that you want the line number for a bookmark named "MBN." Second, it assumes that you want the line number entered in the document at the location of the insertion point.

A macro such as this is not as automatic as a field; it must be run every time you want the line number. (Obviously, this may mean deleting the line number generated by the macro the last time you ran it.) Plus, if the MBN bookmark stretches over more than a single line, it is only the line number of the first character in the bookmark that is entered in the document.

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 (9452) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.

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

Getting Rid of Trailing Spaces in Footnotes and Endnotes

The Find and Replace tool can get rid of trailing spaces in paragraphs quite nicely. If those spaces are at the end of ...

Discover More

Sequentially Numbering Footnotes

If you have a document with lots of footnotes, you might notice that some of those footnotes are not in numerical order, ...

Discover More

Boxes in Boxes

When you insert a text box within another text box, you may expect any text in the outer text box to wrap around the ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2021 or Microsoft 365. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word Step by Step today!

More WordTips (ribbon)

Fields in Footnotes Won't Update Automatically

Fields can be very helpful for including dynamic information in your documents, such as cross-references. It can be ...

Discover More

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

Shortcut to Display Bookmarks

It can be helpful to see where the bookmarks are located in a document. This tip provides a quick way that you can both ...

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 5 + 3?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

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.