[求助]VBA如何在本图遍寻找字符串且代替
<P>请给个例子,我是新手。谢谢</P> 我在源码共享里发了一个文字多重替换程序,你可以找找看我的程序,为何不好用
本帖最后由 作者 于 2005-10-6 8:09:15 编辑 <br /><br /> <P>On Error Resume Next<BR> Dim n As Integer<BR> Dim textold As String, textnew As String<BR> Dim Enttype As Variant<BR> Dim Endata As Variant<BR> textold = "MetalclipsLONG"<BR> textnew = "sss"<BR> On Error Resume Next<BR> For n = 0 To ThisDrawing.ModelSpace.Count - 1<BR> 'If ThisDrawing.ModelSpace(n).EntityType = acText Then<BR> ThisDrawing.ModelSpace(n).GetXData "", 0, Enttype<BR> If Enttype = "text" Then<BR> ThisDrawing.ModelSpace(n).GetXData "", 1, Endata<BR> If Endata = textold Then<BR> <BR> ThisDrawing.ModelSpace(n).SetXData 1, textnew<BR> End If<BR> End If<BR> Next<BR> On Error Resume Next</P> <P>如果要替换的文字在一个字符串中就不能用了,我建议你遍历所有字符,可以解决</P>
页:
[1]