the following code is based on suggestion by R. Robert Bell
to get attribute tagstrings from BlockDef:
Public Sub Stdz_Malform_Tagnames2()
' BlockDefinition objects
' this Sub selects & modifies BlockDefinition objects, _
not BlockReference objects
On Error GoTo ERR_HAND
Dim oMyBlock As AcadBlock
Set oMyBlock = ThisDrawing.Blocks.Item(myTBlock)
Dim oEnt As AcadEntity
For Each oEnt In oMyBlock
If TypeOf oEnt Is AcadAttribute Then
oEnt.TagString = "MyNewTag"
End If ' AcadAttribute
Next oEnt
Exit Sub
ERR_HAND:
Resume
End Sub
PROBLEM: when oEnt is MText entity, endless loop results when "Next oEnt" is processed; execution causes error which triggers On Error which executes Resume which returns to "Next oEnt" which......
have set Watch on oEnt and when this trap occurs, oEnt Type=AcadEntity/lAcadMText in Watches box.
any suggestions for avoiding this debilitating loop?
marklewis


Reply With Quote
