Word Macro to count inserted (wdRevisionInsert), deleted (wdRevisionDelete), and no revision (wdNoRevision) words

63 Views Asked by At

I use this Macro by Jay Freedman (https://www.pcreview.co.uk/threads/macro-to-count-tracked-insertions.2832489/) to count inserted words (wdRevisionInsert) and it works very well.

I would like to also count deleted (wdRevisionDelete) and no revision (wdNoRevision) words.

Sub CountInsertWords2()
Dim aRev As Revision, I As Integer, rgOrig As Range
Set rgOrig = Selection.Range
Application.ScreenUpdating = False
For Each aRev In ActiveDocument.Revisions
If aRev.Type = wdRevisionInsert Then
aRev.Range.Select
With Dialogs(wdDialogToolsWordCount)
.Execute
I = I + .Words
End With
End If
Next aRev
rgOrig.Select
Application.ScreenUpdating = True
MsgBox I & " words"
Set rgOrig = Nothing
End Sub

I tried replacing wdRevisionInsert with either wdRevisionDelete or wdNoRevision, but in both instances, the count came up as zero.

Does anyone know a way to count these things?

Thank you in advance for any help!

0

There are 0 best solutions below