#1
|
|||
|
|||
Macro to check percentage revisions in a file with tracked changes
Hi everyone,
I hope I'm in the right place for this. I'm on the lookout for a macro that'll calculate the percentage of revisions on a word file with tracked changes. Does a macro like this already exist? If not, any tips on how I can go about designing something like this would be great! Thanks, |
#2
|
||||
|
||||
Would would the percentage relate to - number of words or the number characters? As a percentage of whatever it relates to as the document exists before making the changes, or after making them? And are the counted revisions for content inserted, moved, deleted, replaced or reformatted?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Sorry for the late response! It would be a percentage of the number of characters changed (either inserted or deleted) to the original character count. I think it cannot be both because the percentage needs to be a 100 and no more (so if a sentence had 100 characters, and lets' say the edit included deleting the entire sentence (100 deletions) and then adding (about 50) characters, the ratio should not exceed 100%. So, in the end, I'm not sure but if I visually saw a sentence full of deletions/insertions I would say it was 100% revisions, but I am not able to put a formula to it. Any suggestions?
|
#4
|
||||
|
||||
But, on your reckoning, if you start out with 100 characters and add another 150, or replace the initial 100 with 150 different characters, the % change would necessarily be 150 in either case.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
True, I can work with that as well. How can I go about desigining something like this?
|
#6
|
||||
|
||||
Try something along the lines of:
Code:
Sub Demo() Application.ScreenUpdating = False Dim bRevShow As Boolean, RevView As Long Dim r As Long, i As Long, d As Long, o As Long With ActiveDocument With ActiveWindow.View bRevShow = .ShowRevisionsAndComments RevView = .RevisionsView .ShowRevisionsAndComments = False .RevisionsView = wdRevisionsViewOriginal End With o = .ComputeStatistics(wdStatisticCharactersWithSpaces) For r = 1 To .Revisions.Count With .Revisions(r) If .Type = wdRevisionInsert Then i = i + .Range.ComputeStatistics(wdStatisticCharactersWithSpaces) If .Type = wdRevisionDelete Then d = d + .Range.ComputeStatistics(wdStatisticCharactersWithSpaces) End With Next With ActiveWindow.View .ShowRevisionsAndComments = bRevShow .RevisionsView = RevView End With MsgBox "The active docuument originally contained " & o & " characters." & vbCr & _ "It has had " & i & " characters added and " & d & " characters deleted." & vbCr & _ "Additions and deletions account for " & Format(i * 100 / o, "0") & "% and " & Format(d * 100 / o, "0") & "%," & vbCr & _ "respectively, of the original length." End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Someone please check my macro | BIMwit | Excel Programming | 6 | 06-13-2015 12:04 PM |
How to open the Revisions pane? | billy8b8 | PowerPoint | 4 | 12-17-2014 04:22 PM |
Code Error - Hiding comments and revisions | silvrwoman | Word VBA | 6 | 03-24-2012 10:15 PM |
Word Macro That Checks a Check Box Form Field When File Print is Executed | DKerne | Word VBA | 4 | 06-09-2011 11:54 AM |
Check Box Macro | Johnny thunder | Word VBA | 12 | 04-07-2011 04:47 PM |