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

Discussion in 'Word' started by adamyyz, Jan 2, 2017.

  1. adamyyz

    adamyyz

    Joined:
    Jan 2, 2017
    Messages:
    1
    Likes Received:
    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
     
    adamyyz, Jan 2, 2017
    #1
    1. Advertisements

  2. adamyyz

    macropod

    Joined:
    Mar 2, 2012
    Messages:
    163
    Likes Received:
    10
    The code you posted doesn't actually include a count of the footnote or endnote content. Simply delete:
    & " " & Footnotes
     
    macropod, Jan 2, 2017
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bvclsaaal

    footnotes not showing

    Bvclsaaal, Jul 12, 2011, in forum: Word
    Replies:
    0
    Views:
    516
    Bvclsaaal
    Jul 12, 2011
  2. TFinnis
    Replies:
    1
    Views:
    583
    macropod
    Jun 13, 2012
  3. Ahasja
    Replies:
    1
    Views:
    610
    chris ford
    Apr 29, 2016
  4. grzybucha

    footnotes

    grzybucha, Jan 12, 2015, in forum: Word
    Replies:
    0
    Views:
    267
    grzybucha
    Jan 12, 2015
  5. iSlam Khaled
    Replies:
    1
    Views:
    281
    iSlam Khaled
    May 2, 2015
  6. Andrew Thorpe
    Replies:
    0
    Views:
    239
    Andrew Thorpe
    Oct 19, 2015
  7. sgreen
    Replies:
    0
    Views:
    242
    sgreen
    Dec 10, 2015
  8. theo
    Replies:
    0
    Views:
    174
Loading...