Sub ForEach()
Dim sr As ShapeRange, s As Shape, stat As AppStatus
Set sr = ActiveSelectionRange: cnt = sr.Count: i = 1
Optimization = True
EventsEnabled = False
ActiveDocument.SaveSettings
ActiveDocument.PreserveSelection = False
On Error Resume Next
Set stat = Application.Status: stat.BeginProgress CanAbort:=True
For Each s In sr
If s.Selectable Then s.CreateSelection: ActiveDocument.Repeat
i = i + 1: stat.Progress = i / cnt * 100
stat.SetProgressMessage "Repeating..." & Str(i) & " / " & Str(reps)
If stat.Aborted Then MsgBox "Command repeated " & Str(i) & " times": Exit For
Next
ActiveDocument.RestoreSettings
EventsEnabled = True
Optimization = False
sr.CreateSelection
CorelDRAW.ActiveWindow.ActiveView.ToFitSelection
End Sub