debkev1010
07-14-2023, 06:34 AM
Hi,
I have some code in which I run against a Word compare (redlines created by Word's Compare/Combine function) document. Some of the redlines Word makes aren't true redlines and I'd like to Reject these redlines to clean-up the document. I've setup a For Each loop to go through the Revisions collection looking for pairs of Insert/Delete. The script takes less than 30 seconds when I have this simple loop below:
Set xRevisions = worddoc.Revisions
For Each xRev in xRevisions
xRev.Range.Select
Next
When I add the following 'if' statement inside the loop to compare the current Revision with the next Revision, the script takes 30 minutes to run:
If xRevisions.Item(xRev.Index).Range.Fields.Count <> 0 or xRevisions.Item(xRev.Index + 1).Range.Fields.Count <> 0 Then
x = x
End If
Is there a faster way to handle this? Seems like a huge difference.
Thanks,
Kevin
I have some code in which I run against a Word compare (redlines created by Word's Compare/Combine function) document. Some of the redlines Word makes aren't true redlines and I'd like to Reject these redlines to clean-up the document. I've setup a For Each loop to go through the Revisions collection looking for pairs of Insert/Delete. The script takes less than 30 seconds when I have this simple loop below:
Set xRevisions = worddoc.Revisions
For Each xRev in xRevisions
xRev.Range.Select
Next
When I add the following 'if' statement inside the loop to compare the current Revision with the next Revision, the script takes 30 minutes to run:
If xRevisions.Item(xRev.Index).Range.Fields.Count <> 0 or xRevisions.Item(xRev.Index + 1).Range.Fields.Count <> 0 Then
x = x
End If
Is there a faster way to handle this? Seems like a huge difference.
Thanks,
Kevin