Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 11-30-2012, 12:10 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: 21,963
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

Hi New Daddy,

It's nothing to do with Word 2003. Rather, it's that ComputeStatistics(wdStatisticWords) doesn't count text marked as deleted. Here's a workaround:
Code:
Function CountRevisions(Rng As Range) As Long
Dim i As Long, j As Long, Str As String
With Rng
  For i = 1 To .Revisions.Count
    If .Revisions(i).Type = wdRevisionInsert Then
      j = j + .Revisions(i).Range.ComputeStatistics(wdStatisticWords)
    ElseIf .Revisions(i).Type = wdRevisionDelete Then
      Str = Trim(.Revisions(i).Range.Text)
      Str = Replace(Str, vbCr, " ")
      While InStr(Str, "  ") > 0
        Str = Replace(Str, "  ", " ")
      Wend
      j = j - (UBound(Split(Str, " ")) + 1)
    End If
  Next
End With
CountRevisions = j
End Function
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



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 10:50 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