Error Handler

Error Handler

Anonymous
Not applicable
382 Views
1 Reply
Message 1 of 2

Error Handler

Anonymous
Not applicable
Hi,
I'm having an issue with on error statements within my error handler. What I want to do is exit the function and delete all selection sets (only if they exist) if an error occurs. Is it possible to have an "On Error Resume Next" statement within the errorhandler? It seems like this statement is not read within the error handler as i still get an error.

I.e.
Function blah........

on error goto Errhandler
:
Exit Function
Errhandler:
On Error Resume Next
sset.delete <-- generates error on this line
sset2.delete
on Error Goto 0
End function
0 Likes
383 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Use the function below before you are make the selectionset.
On Error Resume Next causes a whole lot of pain.
Public Function DeleteSelectionSet(SSetName As String)
Dim SSets As AcadSelectionSets
Dim sset As AcadSelectionSet
Set SSets = ThisDrawing.SelectionSets
For Each sset In SSets
If sset.Name = SSetName Then
sset.Delete
Exit For
End If
Next
Set SSets = Nothing
End Function
0 Likes