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 Microsoft MVP

    Joined:
    Mar 2, 2012
    Messages:
    241
    Likes Received:
    19
    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?

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

    footnotes not showing

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

    footnotes

    grzybucha, Jan 12, 2015, in forum: Word
    Replies:
    0
    Views:
    324
    grzybucha
    Jan 12, 2015
  5. iSlam Khaled
    Replies:
    1
    Views:
    320
    iSlam Khaled
    May 2, 2015
  6. Andrew Thorpe
    Replies:
    0
    Views:
    282
    Andrew Thorpe
    Oct 19, 2015
  7. sgreen
    Replies:
    0
    Views:
    285
    sgreen
    Dec 10, 2015
  8. theo
    Replies:
    0
    Views:
    217
Loading...