Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2013, 11:33 AM
d4okeefe d4okeefe is offline Count Number of Pages in Document with Footnotes Windows Vista Count Number of Pages in Document with Footnotes Office 2007
Advanced Beginner
Count Number of Pages in Document with Footnotes
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default Count Number of Pages in Document with Footnotes

I need a macro that will count the number of pages in a word document in which footnotes appear?



Thanks
Reply With Quote
  #2  
Old 10-18-2013, 04:10 PM
macropod's Avatar
macropod macropod is offline Count Number of Pages in Document with Footnotes Windows 7 32bit Count Number of Pages in Document with Footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Finding which pages contain footnote references is easy enough, but finding pages where the footnote from a previous page has overflowed onto it is more problematic.

For the former, try:
Code:
Sub FindFootnotePages()
Dim i As Long, Rng As Range, j As Long, k As Long, StrPages As String
With ActiveDocument
  If .ComputeStatistics(wdStatisticPages) > .Footnotes.Count Then
    For i = 1 To .Footnotes.Count
      If .Footnotes(i).Range.Information(wdActiveEndPageNumber) > k Then
        k = .Footnotes(i).Range.Information(wdActiveEndPageNumber)
        j = j + 1
        StrPages = StrPages & k & " "
      End If
    Next
  Else
    For i = 1 To .ComputeStatistics(wdStatisticPages)
      Set Rng = ActiveDocument.GoTo(What:=wdGoToPage, Name:=i)
      Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
      If Rng.Footnotes.Count > 0 Then
        j = j + 1
        StrPages = StrPages & i & " "
      End If
    Next
  End If
  If j <> 0 Then
    StrPages = " references, on pages: " & vbCr & Replace(Trim(StrPages), " ", ", ") & "."
  Else
    StrPages = "s."
  End If
  MsgBox "The document: " & .Name & " contains " & j & " footnote" & StrPages
End With
Set Rng = Nothing
End Sub
For some code to get you started with the latter, see:
http://www.vbaexpress.com/forum/show...l=1#post291194
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-21-2013, 02:53 PM
d4okeefe d4okeefe is offline Count Number of Pages in Document with Footnotes Windows Vista Count Number of Pages in Document with Footnotes Office 2007
Advanced Beginner
Count Number of Pages in Document with Footnotes
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default

That's great. Thanks.
Reply With Quote
  #4  
Old 10-21-2013, 03:14 PM
d4okeefe d4okeefe is offline Count Number of Pages in Document with Footnotes Windows Vista Count Number of Pages in Document with Footnotes Office 2007
Advanced Beginner
Count Number of Pages in Document with Footnotes
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default

Any ideas for how to solve the problem of counting footnotes that fall to a subsequent page? Is there a way to identify how many times the Continuation Notice is used in a document? Or, a way to count the number of times the footnote separator is used?

Thanks again. I always get great answers on this site.
Reply With Quote
  #5  
Old 10-21-2013, 07:28 PM
macropod's Avatar
macropod macropod is offline Count Number of Pages in Document with Footnotes Windows 7 32bit Count Number of Pages in Document with Footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by d4okeefe View Post
Any ideas for how to solve the problem of counting footnotes that fall to a subsequent page?
As indicated in my previous reply, there's some code for that in the link. As I'm travelling at the moment, I'm not in a position to personalize that code.
Quote:
Originally Posted by d4okeefe View Post
Is there a way to identify how many times the Continuation Notice is used in a document? Or, a way to count the number of times the footnote separator is used?
Possibly, but the code I provided already returns the same count as you'd get for the latter.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 11-11-2013, 11:02 AM
d4okeefe d4okeefe is offline Count Number of Pages in Document with Footnotes Windows Vista Count Number of Pages in Document with Footnotes Office 2007
Advanced Beginner
Count Number of Pages in Document with Footnotes
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default A solution

Here is the solution I came to. All of the documents I analyze use separators when producing footnotes. The macro checks each page for separator stories and adds the result. Thanks again for your help.

Code:
  Dim aPage As Page
  Dim j As Long, k As Long, l As Long, m As Long, x As Long, y As Long
  j = ActiveDocument.ComputeStatistics(wdStatisticPages) 'Total Page Count
  k = 0 'keeps track of current page being analyzed
  l = 0 'counts Separator Story
  m = 0 'counts Continuation Separator Story
  For Each aPage In ActiveDocument.ActiveWindow.ActivePane.Pages
    k = k + 1
    x = aPage.Rectangles.count 'counts Rectangles on each Page
    For y = 1 To x 'cycles through Rectangles on each Page
      If aPage.Rectangles.Item(y).RectangleType = wdTextRectangle Then
        If aPage.Rectangles.Item(y).Range.StoryType = wdFootnoteSeparatorStory Then
          l = l + 1
        End If
        If aPage.Rectangles.Item(y).Range.StoryType = wdFootnoteContinuationSeparatorStory Then
          m = m + 1
        End If
      End If
    Next
  Next
  Debug.Print l + m
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Number of Pages in Document with Footnotes Display unique values and count the number of child items vthomeschoolmom Excel 2 07-25-2013 06:17 AM
Count Number of Pages in Document with Footnotes page count increases on its own -inserts white pages itsema Word 1 03-06-2013 12:48 PM
Count number of emails from each category HxG Outlook 0 09-19-2012 11:55 PM
Footnotes: custome number format btorrance Word 2 07-30-2012 10:47 AM
Count Number of Pages in Document with Footnotes I don t want the footnotes to be numbered continiously in all pages mj2000 Word 1 10-24-2011 12:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft