View Single Post
  #6  
Old 16-11-2007, 19:58
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

Quote:
Originally Posted by diwin View Post
I already have in the code...
Optimization = True
Optimization = False
ActiveWindow.Refresh
Looks strange in this exact notation... :-) this is what I use:
Code:
Sub boostStart(Optional unDo$)
   On Error Resume Next
   If Len(unDo) Then ActiveDocument.BeginCommandGroup unDo
   Optimization = True
   EventsEnabled = False
   ActiveDocument.SaveSettings
   ActiveDocument.PreserveSelection = False
End Sub

Sub boostFinish(Optional ByVal endUndoGroup As Boolean = False, Optional ByVal doRedraw As Boolean = True)
   On Error Resume Next
   ActiveDocument.PreserveSelection = True
   ActiveDocument.RestoreSettings
   EventsEnabled = True
   Optimization = False
   If endUndoGroup Then ActiveDocument.EndCommandGroup
   
   If doRedraw Then
      CorelScript.RedrawScreen
      ActiveWindow.Refresh
      Application.Refresh
   End If
End Sub
Usage:
boostStart "Action description"
........
.....action........
........
boostFinish True

just don't forget to pair boostStart and Finish in case of premature procedure exits
Reply With Quote