Macro to count words in a section, excluding footnotes and end notes

Joined
Jan 2, 2017
Messages
1
Reaction score
0
Hi,

I am trying to get a macro to count the words in various sections of a document, but not including the footnote and and note count. Right now i found this on another website and it does what I need but does not remove footnotes and endnotes. Does anyone know how to do that?

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.Words.Count _
& vbCrLf
Next

Summary = Summary & "Document: " & _
ActiveDocument.Range.Words.Count & " " & Footnotes
MsgBox Summary

Selection.TypeText Text:=Summary
End Sub
 

macropod

Microsoft MVP
Joined
Mar 2, 2012
Messages
580
Reaction score
50
The code you posted doesn't actually include a count of the footnote or endnote content. Simply delete:
& " " & Footnotes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top