View Single Post
 
Old 03-10-2021, 06:45 AM
Sylvain Sylvain is offline Windows 10 Office 2016
Novice
 
Join Date: Mar 2021
Posts: 1
Sylvain is on a distinguished road
Default Counting footnotes in Word

Hello everyone,

I use this macro to count characters on each section of a word document and write each count in an Excel file.

Code:
Sub CountSection()

    Dim NumSec As Integer
    Dim S As Integer
    Dim Summary As String

    Dim appXl As Excel.Application
    Dim wb As Excel.Workbook
    Set appXl = GetObject(, "Excel.Application")
'   Set appXl = CreateObject("Excel.Application")
    appXl.Visible = True
    
    Dim LastRow As Long

    appXl.Range("D17").Select
    
    NumSec = ActiveDocument.Sections.Count

    For S = 2 To NumSec
  
        Summary = Summary & ActiveDocument.Sections(S).Range.ComputeStatistics(Statistic:=wdStatisticCharactersWithSpaces)
        appXl.Selection.Offset(1, 0).Select
        appXl.Selection.Value = Summary
        Summary = 0
    
    Next

End Sub
The problem is I can't count the character of the footnotes of each section.
So the whole character count is not right.

I tried adding IncludeFootnotesAndEndnotes:=True
It's not working.
Any idea ?

Thanks !

Sylvain

Last edited by macropod; 03-10-2021 at 02:45 PM. Reason: Added code tags
Reply With Quote