Message 1 of 4
How to delete all block attributes from a block using vba
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think the question it self is pretty much descriptive.
What I want to do is loop through all the blocks, find all the block attributes for each block, and delete them permanently one by one.
I tried to write a piece of code, but it doesn't work, when I explode the block, I still got all the attributes coming out.
Sub ClearAtt() Dim objBlock As AcadBlockReference Dim objEntity As AcadEntity Dim objAttributes As AcadAttributeReference Dim AttList As Variant Dim I As Integer For Each objEntity In ThisDrawing.ModelSpace If objEntity.EntityName = "AcDbBlockReference" Then Set objBlock = objEntity If objBlock.HasAttributes Then AttList = objBlock.GetAttributes For I = LBound(AttList) To UBound(AttList) Set objAttributes = AttList(I) objAttributes.Erase objBlock.Update Next End If End If Next End Sub