Message 1 of 4
'Cannot be erased by caller' run-time error message - Trying to delete a block

Not applicable
04-05-2002
02:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In AutoCAD Map 2000 I am trying to check for an existing block and, if
exists, delete the block before inserting another block in Paper Space, ie.
the block "QSSwrLgnd" already exists and before I insert another block
"QSWtrLgnd", I want to delete the first block. However the program stops on
line 'ThisDrawing.Blocks.Item(i).Delete' and a run time error message
"Cannot be erased by caller" is displayed. What's up with this? I may be
way off base here with the code so be easy on me if I am (I don't do this
kind of thing oftenenough) - Thanks in advance for all help/suggestions/etc.
Dim EntGrp(0) As Integer
Dim EntPrp(0 TO 1) As Variant....
....Set ssnew2 = ThisDrawing.SelectionSets.Add("tmpblock")
EntGrp(0) = 2
EntPrp(0) = "QSSwrLgnd"
EntPrp(1) = "QSWtrLgnd"
ssnew2.Select acSelectionSetAll, EntGrp, EntPrp
If ssnew2.count >= 1 Then
For i = 0 To ssnew2.count - 1
ThisDrawing.Blocks.Item(i).Delete
Next i
End If
ThisDrawing.SelectionSets.Item("tmpblock").Delete....
exists, delete the block before inserting another block in Paper Space, ie.
the block "QSSwrLgnd" already exists and before I insert another block
"QSWtrLgnd", I want to delete the first block. However the program stops on
line 'ThisDrawing.Blocks.Item(i).Delete' and a run time error message
"Cannot be erased by caller" is displayed. What's up with this? I may be
way off base here with the code so be easy on me if I am (I don't do this
kind of thing oftenenough) - Thanks in advance for all help/suggestions/etc.
Dim EntGrp(0) As Integer
Dim EntPrp(0 TO 1) As Variant....
....Set ssnew2 = ThisDrawing.SelectionSets.Add("tmpblock")
EntGrp(0) = 2
EntPrp(0) = "QSSwrLgnd"
EntPrp(1) = "QSWtrLgnd"
ssnew2.Select acSelectionSetAll, EntGrp, EntPrp
If ssnew2.count >= 1 Then
For i = 0 To ssnew2.count - 1
ThisDrawing.Blocks.Item(i).Delete
Next i
End If
ThisDrawing.SelectionSets.Item("tmpblock").Delete....