View Single Post
 
Old 10-17-2020, 03:49 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,945
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

Putting the with/end with inside the loop doesn't look particularly efficient so I tried putting it outside and got significant speed improvements. It still doesn't run as fast as I would like but it's better than nothing.
Code:
Sub aTest()
  Dim iRev As Long

  With ActiveDocument.Range.Revisions
    For iRev = .Count To 1 Step -1
      If iRev Mod 10 = 0 Then Debug.Print iRev, .Item(iRev).Type
    Next iRev
  End With
  MsgBox "Stage 1 done"

  For iRev = ActiveDocument.Range.Revisions.Count To 1 Step -1
      With ActiveDocument.Range.Revisions(iRev)
        If iRev Mod 10 = 0 Then Debug.Print iRev, .Type
      End With
  Next iRev
  MsgBox "Stage 2 done"
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote