Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-27-2012, 02:52 PM
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,520
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

Try changing the Function to:


Code:
Function CountRevisions(Rng As Range) As Long
Dim i As Long, j As Long
With Rng
  For i = 1 To .Revisions.Count
    If .Revisions(i).Type = wdRevisionInsert Then
      j = j + .Revisions(i).Range.ComputeStatistics(wdStatisticWords)
    End If
  Next
End With
CountRevisions = j
End Function
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #2  
Old 11-27-2012, 09:09 PM
New Daddy New Daddy is offline Word counting macro for newly added portion? Windows Vista Word counting macro for newly added portion? Office 2003
Advanced Beginner
Word counting macro for newly added portion?
 
Join Date: Jan 2012
Posts: 90
New Daddy is on a distinguished road
Default

It's perfectly working now! Thanks!

Last edited by macropod; 12-09-2012 at 05:34 PM. Reason: Deleted unnecessary quote of entire post replied to
  #3  
Old 11-29-2012, 11:16 PM
New Daddy New Daddy is offline Word counting macro for newly added portion? Windows Vista Word counting macro for newly added portion? Office 2003
Advanced Beginner
Word counting macro for newly added portion?
 
Join Date: Jan 2012
Posts: 90
New Daddy is on a distinguished road
Default

In an attempt to be honest about my daily work progress, I added a couple of lines to the CountRevisions function so that it can subtract the number of words deleted, to give the total the net words added. But it doesn't work. It doesn't seem to be subtracting the number of words deleted.

Any idea why not? Could this be another Word 2003 issue?

Code:
Function CountRevisions(Rng As Range) As Long
Dim oRev As revision, i As Long, j As Long

With Rng
  For i = 1 To .Revisions.Count
    If .Revisions(i).Type = wdRevisionInsert Then
      j = j + .Revisions(i).Range.ComputeStatistics(wdStatisticWords)
    End If
    If .Revisions(i).Type = wdRevisionDelete Then
      j = j - .Revisions(i).Range.ComputeStatistics(wdStatisticWords)
    End If
  Next
End With

CountRevisions = j
End Function
Closed Thread



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 11:33 PM.


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