Accessing Footnote Text in a Macro

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


Gary would like to process the information stored in footnotes using a macro. However, he cannot figure out how to do so. He wonders how to step through each footnote and access just the text of the footnote, not the footnote's number.

The key to accessing footnotes in VBA is to use the Footnotes collection, which contains all of the footnotes in the document. This means you can use a For...Each loop to step through each of your footnotes, in this manner:

Sub DoFootnotes()
    Dim fn As Footnote
    Dim sTemp As String

    For Each fn In ActiveDocument.Footnotes
        sTemp = fn.Range.Text
        '
        ' Do something here based on contents of sTemp
        '
    Next fn
End Sub

Note that the value in the .Text property is the text of your footnote, and this macro code assigns that to the sTemp variable. You can then slice and dice sTemp in any way you want to do your processing. You can also, if desired, stuff information back into the .Text property to change the contents of the footnote.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13521) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

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

Date Last Edited

When adding headers or footers to your worksheets, you may want to include the date that the workbook was last edited. ...

Discover More

Selecting a Paper Source

If your printer allows you to specify different paper trays as sources for paper, you need to know how to select those ...

Discover More

Counting Unique Values with Functions

Using Excel to maintain lists of information is not unusual. When working with the list you may need to determine how ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Restarting Footnote Numbering after Page Breaks

Footnotes can be handled many different ways in a document. If you want to restart the numbering of your footnotes every ...

Discover More

Changing What Follows a Footnote Number

Word makes it easy to insert footnotes in your document. It doesn't, however, make it easy to change the format in which ...

Discover More

Converting Hyperlinks to Footnotes

If you have a document that contains a lot of active hyperlinks, you can use a macro to convert those hyperlinks to ...

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 0 + 7?

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.