Incorrect entity name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
When I execute successively the sub named "Label" and after the sub named "Delete", I get the following error "-2145320958 (80210002): Incorrect entity name" on the line ssetObj.Erase
Sub Label()
Dim Point1 As Variant
Dim Point2 As Variant
Dim LeaderPoints(0 To 5) As Double
Dim Leader As AcadMLeader
Dim i As Long
Point1 = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
Point2 = ThisDrawing.Utility.GetPoint(Point1, "Enter a point: ")
LeaderPoints(0) = Point1(0): LeaderPoints(1) = Point1(1): LeaderPoints(2) = Point1(2)
LeaderPoints(3) = Point2(0): LeaderPoints(4) = Point2(1): LeaderPoints(5) = Point2(2)
Set Leader = ThisDrawing.ModelSpace.AddMLeader(LeaderPoints, i)
Leader.textString = "Example"
End Sub
Sub Delete()
Dim ssetObj As AcadSelectionSet
For Each ssetObj In ThisDrawing.SelectionSets
If ssetObj.Name = "SSET" Then
ThisDrawing.SelectionSets("SSET").Delete
Exit For
End If
Next ssetObj
Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
ssetObj.SelectOnScreen
If ssetObj.Count = 0 Then Exit Sub
ssetObj.Erase
End Sub
If somebody have an idea, I will appreciate.
Thank you for your help