Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
with VBA, how do you loop through all objects in a block and then change the text of only the mtext objects?
Solved! Go to Solution.
with VBA, how do you loop through all objects in a block and then change the text of only the mtext objects?
Solved! Go to Solution.
Assume by "... in a block", you mean a block definition, and you know that any change to the block definition will result in changes of all inserted block references to this block definition.
Here is the code that does what you aksed:
Private Sub UpdateBlockDefinition(blkName As String)
Dim ent As AcadEntity
Dim blk As AcadBlock
Dim mt As AcadMText
For Each blk in ThisDrawing.Blocks
If UCase(blk.Name) = UCase(blkName) Then
For Each ent In blk
If TypeOf ent Is AcadMText Then
Set mt=ent
mt.TextString="AAAAA"
mt.Update
End If
Next
Exit For
End If
Next
End Sub
Thank you Norman, much appreciated
these two lines is what i was missing.
For Each ent In blk
If TypeOf ent Is AcadMText Then