Results 1 to 3 of 3

Thread: How to Delete all the Block attributes from a block using VBA.

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2017-01
    Posts
    1
    Login to Give a bone
    0

    Default How to Delete all the Block attributes from a block using VBA.

    I think the question its self is pretty much descriptive.

    What I want to do is loop through all the blocks, find all the block references, 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

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: How to Delete all the Block attributes from a block using VBA.

    Your only deleting the attribute value, you need to redefine the block without attributes.

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: How to Delete all the Block attributes from a block using VBA.

    Maybe a simple way use bedit on block delete attributes, save, this will redefine the block then do attsync on all blocks.

Similar Threads

  1. Replies: 1
    Last Post: 2014-06-16, 07:54 PM
  2. Replies: 3
    Last Post: 2013-01-30, 05:19 PM
  3. Replies: 2
    Last Post: 2012-06-06, 12:28 PM
  4. Replies: 2
    Last Post: 2011-05-23, 12:03 PM
  5. Extract Dynamic Block Attributes, values change as Block changes
    By dave.buckberry in forum Dynamic Blocks - Technical
    Replies: 11
    Last Post: 2006-09-05, 04:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •