我想在CAD中做到批量修改文字,比如我有一组文字 1 2 3 4 我要批量修改成 A B C D 最好通过CAD中的VBA实现

实际上需要替换的文字与被替换的文字只有1对A的对应的关系。由于需要替换的文字很多使用CAD中的替换功能太费时间,所以我想通过VBA来实现。
例子 sub 数据批量替换()
dim (文字变量)as (文字对象)
文字变量=1 文字变量=2 文字变量=3.........
替换文字=A 替换文字=B 替换文字=C.........
end sub 基本就是这个意思 当然如果有其它方法可以达到目的也可以。 工作很急!!!!! 望高手解救!!!!奉上全部家当50分 表示感谢!!

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追问

这段代码很好 但我没搞明白如何批量的进行替换?

追答

Sub 替换()
End Sub

温馨提示:答案为网友推荐,仅供参考
相似回答