VBA RemoveBadOps

Sub RemoveBadOps() Dim OP As Esprit.Operation Dim I As Integer

For I = Document.Operations.Count To 1 Step -1
       If IsBadOp(I) Then
           MsgBox "Removing an Operation"
           Document.Operations.Remove (I)
       Else
           Document.Operations.Item(I).Rebuild
       
       End If
   Next I

End Sub

Function IsBadOp(index As Integer) As Boolean

IsBadOp = False
   
   Dim OP As Esprit.Operation
   On Error GoTo BadOp
   Set OP = Document.Operations(index)
   
   Exit Function

BadOp:

   IsBadOp = True

End Function

Schreibe einen Kommentar