基本是这样子的 dim strDwgName As String dim strFind As String dim strReplace As String Dim ent As AcadEntity For Each ent In Thisdrawing.ModelSpace If TypeOf ent Is AcadText Or TypeOf ent Is AcadMText Then With ent If InStr(.TextString, strFind) Then .TextString = ReplaceStr(.TextString, strFind, strReplace, False) End With End If Next ent
strFind = "耳板" Dim objBlkRef As AcadBlockReference Dim varAttributes '取得块属性,显示属性标签和值
For Each ent In ThisDrawing.ModelSpace If TypeOf ent Is AcadBlockReference Then Set objBlkRef = ent varAttributes = objBlkRef.GetAttributes If UBound(varAttributes) Then For i = 0 To UBound(varAttributes) If varAttributes(i).TextString = strFind Then varAttributes(i).TextString = "strFind" End If Next i End If