Including Text Box Text in Word Counts

Written by Allen Wyatt (last updated April 28, 2018)
This tip applies to Word 97, 2000, 2002, and 2003


Word has this nifty tool that counts the number of words in your document for you. The only problem is, it doesn't count all words. For instance, if your document contains text boxes, the word count tool won't include any text in the word boxes in the overall word count for the document. This can be a real problem, particularly if you are using text boxes to implement a special document element, such as sidebars.

There is a way around the problem, however. You can count all the words in the main portion of your document as you normally would, and then write down that number. Then move the insertion point into a text box. If you run the word count tool, Word returns the number of words in that text box. If you select multiple text boxes before running the word count tool, then Word returns the count of all words in all the text boxes you selected. If you are using linked text boxes, then you don't have to select them all, but you do need to move the insertion point into the last text box in the series. When you add together the word count in the main document, plus the word count for any text boxes, you will have the word count for the entire document.

If you use text boxes a lot, the above process can get rather bothersome. If you prefer, you can create a macro that will automate the process for you. The following macro determines the word count in the main document, and adds to it the word count for each text box in the document. The result is a total word count, as described above.

Sub TxtBxCount()
    Dim i As Integer
    Dim TxtWrds As Range
    Dim TxtWrdsStats As Long
    Dim ToTxtWrds As Long
    Dim Lngwords As Long
    Dim ToWords As Long

    Lngwords = ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
    For s = 1 To ActiveDocument.Shapes.Count
        Set TxtWrds = ActiveDocument.Shapes(s).TextFrame.TextRange
        TxtWrdsStats = TxtWrds.ComputeStatistics(Statistic:=wdStatisticWords)
        ToTxtWrds = ToTxtWrds + TxtWrdsStats
    Next
    ToWords = Lngwords + ToTxtWrds
    MsgBox ("The document has " & Format(ToWords, "##,##0") & " words.")
End Sub

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 (1658) applies to Microsoft Word 97, 2000, 2002, and 2003.

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

Adding Text to an AutoShape

You can add text to all sorts of drawing shapes, not just text boxes. Here's how easy it is.

Discover More

Understanding Mirror Margins

Rather than have the margins of your documents always be the same, you can use what Word calls "mirror margins." Here's ...

Discover More

AutoFill with Random Numbers

When entering data into a worksheet, you may have a need to fill a range of cells with a group of random numbers. This ...

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)

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

Different Layout for a Portion of a Page

Got a document layout that requires a portion of the page to be in one layout and another portion to be in a different ...

Discover More

Creating Sideheads

A sidehead can be used as a layout element for a document. You can create sideheads in a document by using text boxes, as ...

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