Share via

SectionWordCount: How to Automate Section Word Count in MS Word?

Anonymous
2025-01-02T04:39:05+00:00

How do I create a macro to automatically count a particular section in a Word document? This question was originally asked in a locked 2022 thread located at NUMWORDS for a specific section, or between two specific words - Microsoft Community

Volunteer Moderator Jay Freedman offered the exact solution for what I need but no information on how to actually create a macro stored in the Normal.dotm or global template at startup. I am the only one editing the document and the final will be converted to a PDF with all macros stripped. The section word count is strictly for personal purposes. If Jay or MVP Volunteer Moderator Suzanne S. Barnhill who also responded to that article -- or any other Word expert -- can help with an automated SECTION WORD COUNT solution, then I'd much appreciate it. NOTE: I am still on Word Pro Plus 2016.

Jay's solution per the older thread.

... there is no way to use a NUMWORDS field to display any number except the total count in the document.

If you are the only one editing this document -- that is, everyone else will only be reading it and possibly adding comments, but not changing anything -- then you certainly can use a macro stored in a different template (such as your Normal.dotm or a global template stored in %appdata%\Microsoft\Word\Startup) to count words in a section or in a selected part of the document. The result could be inserted as plain text into the document at a predefined bookmark or in a content control. The macro would stay on your computer and would not accompany the document when sent to another computer, so it wouldn't need the reader's permission to run.

If you need sample code to get started, post a reply.

Thank you.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Jay Freedman 207.6K Reputation points Volunteer Moderator
    2025-01-02T13:18:50+00:00

    I'm still here. :-)

    A macro can probably do what you want, but the details of the task aren't clear from your post. Its design will depend on (a) what you mean by "automated", (b) how you want the result to be displayed, and (c) which section's word count should be displayed.

    If "automated" means "updating in real time without any special keystroke to launch the macro", that's possible but probably not necessary, given the next points. The count could be displayed in a message box (only when requested by a keyboard shortcut) or constantly in the status bar at the bottom of the window (but then the usual contents of the status bar can't be shown, which may be problematic). In either case, the count could be only for the section that contains the cursor; the message box could contain the counts for all sections.

    I suspect you want this macro only for the document you're working on now, not for all your documents. If the macro is stored in your Normal.dotm template, it would have to verify -- each time it starts -- that the active document is the correct one; that's not a good idea. Instead, the macro should be stored in the document itself or in the template on which the document is based (which should not be Normal.dotm). Since the document will be distributed as a PDF, the document can be a macro-enabled (*.docm) file instead of a *.docx,

    I'll guess that if you need instructions on how to create and store a macro, you've never done those tasks, so the explanation has to be at beginner level. You should start by reading https://www.gmayor.com/installing_macro.htm .

    2 people found this answer helpful.
    0 comments No comments
  2. Paul Edstein 82,861 Reputation points Volunteer Moderator
    2025-01-02T07:06:16+00:00

    Is there a reason for not using the approach outlined in the thread you linked to, viz:

    select a section, then choose Review>Word Count to get the number of selected words. The word count dialog includes an option to ignore textboxes, footnotes and endnotes.

    There is no automatic way of doing this.

    2 people found this answer helpful.
    0 comments No comments
  3. Charles Kenyon 166.7K Reputation points Volunteer Moderator
    2025-01-03T15:24:58+00:00

    I urge you to send public feedback via thefeedback portaland post a link to it here so that others can vote and comment. There has long been a need for a SectionWords field or a Status Bar setting. I do not really expect that MS will do this since they seem focused on the online app.

    This is a user-to-user support forum. -- You can give feedback TO MICROSOFT designers and decision makers on Microsoft Word or other Microsoft Products using their feedback mechanisms, (not here). (This is a link to directions.)

    Do not expect to get a direct response. Such responses to feedback are extremely rare. However, I have seen Word get modified in response to user feedback (including from me).

    1 person found this answer helpful.
    0 comments No comments