Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 01-26-2012, 01:16 AM
macropod's Avatar
macropod macropod is offline Word counting macro for newly added portion? Windows 7 64bit Word counting macro for newly added portion? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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 New Daddy View Post
Is there a way to make this macro count revisions in the footnotes as well?
I've been trying to combine .Footnotes and .Revisions with ActiveDocument, but it doesn't seem to work.
Hi New Daddy,

Yes, the macro's scope can be expanded, but I'd rather not do it piecemeal:
Code:
Sub WordsForToday()
Application.ScreenUpdating = False
Dim Sctn As Section, oHdFt As HeaderFooter, lHdr As Long, lFtr As Long
Dim oEnt As Endnote, lEnt As Long, oFnt As Footnote, lFnt As Long
Dim oShp As Shape, lShp As Long
With ActiveDocument
  For Each oEnt In .Endnotes
    lEnt = lEnt + CountRevisions(oEnt.Range)
  Next
  For Each oFnt In .Footnotes
    lFnt = lFnt + CountRevisions(oFnt.Range)
  Next
  For Each Sctn In .Sections
    For Each oHdFt In Sctn.Headers
      If Not oHdFt.LinkToPrevious Then _
        lHdr = lHdr + CountRevisions(oHdFt.Range)
    Next
    For Each oHdFt In Sctn.Footers
      If Not oHdFt.LinkToPrevious Then _
        lFtr = lFtr + CountRevisions(oHdFt.Range)
    Next
  Next
  For Each oShp In .Shapes
    If Not oShp.TextFrame Is Nothing Then _
      lShp = lShp + CountRevisions(oShp.TextFrame.TextRange)
  Next
  MsgBox "Today's Word Count Statistics:" & vbCr & _
    "EndNotes - " & vbTab & lEnt & vbCr & _
    "Footnotes - " & vbTab & lFnt & vbCr & _
    "Headers - " & vbTab & vbTab & lHdr & vbCr & _
    "Footers - " & vbTab & vbTab & lFtr & vbCr & _
    "Shapes - " & vbTab & vbTab & lShp & vbCr & _
    "Other - " & vbTab & vbTab & CountRevisions(.Range)
End With
Application.ScreenUpdating = True
End Sub
 
Function CountRevisions(Rng As Range) As Long
Dim oRev As Revision, i As Long
For Each oRev In Rng.Revisions
  If Int(oRev.Date) = Date And oRev.Type = wdRevisionInsert Then
    i = i + oRev.Range.ComputeStatistics(wdStatisticWords)
  End If
Next
CountRevisions = i
End Function
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word counting macro for newly added portion? Counting Colors g48dd Excel 2 03-13-2011 09:28 PM
Added letters to body message kawzie Outlook 1 07-12-2010 11:00 AM
Word counting macro for newly added portion? Half hour added between tasks maruchi Project 1 06-17-2010 08:06 AM
Form field to automatically be added to header? razberri Word VBA 3 02-22-2010 03:48 PM
Word counting macro for newly added portion? Help! All Messages in Web Email deleted when account added to Outlook UrbanEast Outlook 2 07-17-2009 09:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:30 AM.


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