7

I know it is possible to add a word count field (NUMCOUNT) to a document to create a dynamic word count, but is it possible to limit the word count to only a section of the document?

I need a solution which does not use Macros/VBA.

Jonny Wright
  • 991
  • 5
  • 16
  • 36

4 Answers4

2

Loosening the VBA restrictions, the macro found on wordribbon.tips.net can calculate the number of words per section, given that each section is followed by a section break:

Sub WordCount()
    Dim NumSec As Integer
    Dim S As Integer
    Dim Summary As String
NumSec = ActiveDocument.Sections.Count
Summary = "Word Count" & vbCrLf

For S = 1 To NumSec
    Summary = Summary & "Section " & S & ": " _
      & ActiveDocument.Sections(S).Range.ComputeStatistics(wdStatisticWords) _
      & vbCrLf
Next

Summary = Summary & "Document: " & _
  ActiveDocument.Range.ComputeStatistics(wdStatisticWords)
MsgBox Summary

End Sub

Note that I replaced .Words.Count with .ComputeStatistics(wdStatisticWords) for a more accurate count (based on the information in this KB article).

The current macro will show an alert with the word count per section, but of course this information can be stored as text in the document as well.

0

It'd be really nice to have a live display of the per-section word count. It's a pain to have to select the whole section every time you want to add it up. I found a workaround:

  1. Open a new window for your document (View > Window > New Window)
  2. Select the words you want counted in this new window. The count should be displayed in the status bar (e.g. "753 of 4824 words") - if not, right-click the status bar and select the relevant option.
  3. Go back to your original window and start typing. The word count in the second window won't be updated live, but only when you switch back to it. You can do this quickly (in Windows) with Alt-Tab.

You'll need to take care if you're adding words at the start or end, and make sure the new content is contained in the selected text in the second window.

Not strictly answering the question (since the word count is not contained in the document) but it might help someone.

benshepherd
  • 1,825
-1

Finding the word-count of a section of the document:

  • Select the section of interest
  • Position to the Review pane
  • In the Proofing group, click on Word Count:

enter image description here

harrymc
  • 498,455
-1

When you select the section, just look at the status bar. The word count is shown there.

Word count shown on the status bar