Sub 替换()
Dim aa As String
Dim bb As String
aa = "我的中国心"
bb = "长江,黄河"
Dim myselection As AcadSelectionSet
For Each myselection In ThisDrawing.selectionSets
If myselection.Name = "qqq" Then
myselection.Delete
Exit For
End If
Next
Set myselection = ThisDrawing.selectionSets.Add("qqq")
myselection.SelectOnScreen
Dim mytext As AcadMText
Dim myentity As AcadEntity
For Each myentity In myselection
If myentity.ObjectName = "AcDbMText" Then
Set mytext = myentity
If mytext.TextString = aa Then
mytext.TextString = bb
End If
A = A + 1
End If
Next
MsgBox A
End Sub