Delete Block in 2004 VBA
Delete Block in 2004 VBA
(OP)
I am using AutoCAD 2004, and trying to delete a block in VBA.
I get an error that the block or object is referenced. In looking thru the help files, I noticed that the Blocks Collection does not have a delete function. But I don't want to delete the whole collection, just a block. Basically, what I tried is:
Dim ABCBlock As AcadBlock
Set ABCBlock = ThisDrawing.Blocks.Item("Canon_Block")
ABCBlock .Delete
I know the block is there. Purge will delete it, but I guess I am just having a mental block on deleting it with code. Any ideas?
I get an error that the block or object is referenced. In looking thru the help files, I noticed that the Blocks Collection does not have a delete function. But I don't want to delete the whole collection, just a block. Basically, what I tried is:
Dim ABCBlock As AcadBlock
Set ABCBlock = ThisDrawing.Blocks.Item("Canon_Block")
ABCBlock .Delete
I know the block is there. Purge will delete it, but I guess I am just having a mental block on deleting it with code. Any ideas?





RE: Delete Block in 2004 VBA
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: Delete Block in 2004 VBA
RE: Delete Block in 2004 VBA
Apparently I need to somehow get the actual object from the AcadBlockReference "collection" (if it is there), and I don't know how to do that.
RE: Delete Block in 2004 VBA
Since I know the name, and am working with only one block, I just kill it like the code says (DeleteRefs part).
I'm good, and thanks again.