
CAD中用宏如何实现批量查找和替换文本? 50
例如,我是想要查找文本内容为“A”、“B”、“C”、“D”的文本替换为“1”、“2”、“3”、“4”,并统计出各自出现的数量。网上找了个例子如:dimstrDwgName...
例如,我是想要查找文本内容为“A”、“B”、“C”、“D” 的文本替换为“1”、“2”、“3”、“4” ,并统计出各自出现的数量。网上找了个例子如:
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
================
但是运行时提示ReplaceStr 子程序或函数未定义,
ReplaceStr 改 Replace 就显示 无效的过程调用或参数 其中 .TextString = Replace(.TextString, strFind, strReplace, False) 标黄。
如果在2010怎么实现?快速选择好像不能用OR连接吧 展开
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
================
但是运行时提示ReplaceStr 子程序或函数未定义,
ReplaceStr 改 Replace 就显示 无效的过程调用或参数 其中 .TextString = Replace(.TextString, strFind, strReplace, False) 标黄。
如果在2010怎么实现?快速选择好像不能用OR连接吧 展开
2个回答
2012-08-21 · 知道合伙人软件行家
关注

推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询