Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 10-17-2020, 03:49 PM
Guessed's Avatar
Guessed Guessed is offline Short loop takes no less than 12s to run, uses 25% CPU power! Windows 10 Short loop takes no less than 12s to run, uses 25% CPU power! Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can i open a power point in design mode through a power point shoe noora PowerPoint 4 12-10-2019 12:18 AM
Google Docs Power Point Short cuts / Insert Image etc Rado PowerPoint 4 04-11-2014 03:50 AM
video loop lag in power point 2013 drwrath PowerPoint 2 04-29-2013 05:53 PM
Microsoft Power Point 2004 to Office Power Point 2007 chuff PowerPoint 0 03-20-2011 01:23 PM
Short loop takes no less than 12s to run, uses 25% CPU power! mail merge takes and age williebear Outlook 1 05-27-2009 11:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:20 AM.


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