请帮助检查一下有什么错误!
<P>有一套程序,主要功能是关闭引用背景图的相关图层的。由用户在TEXTBOX1中输入需要关闭的图层名称,几个图层之间要用;分隔。由于所有引用都有引用名称如XREF1等。如图层:XREF1│0,故关闭时需要从图层名称的后几位开始。程序如下:</P><P>Private Sub CommandButton1_Click()<BR> Dim layname As String<BR> Dim z As Integer<BR> Dim ii As Integer<BR> Dim lay4 As AcadLayer<BR> z = 1<BR> For ii = 1 To Len(TextBox1.Text)<BR> ii = InStr(z, TextBox1.Text, Chr(59))<BR> If ii = 0 Then<BR> layname = Mid(TextBox1.Text, z, (Len(TextBox1.Text)))<BR> ii = Len(TextBox1.Text) + 1<BR> Else<BR> layname = Mid(TextBox1.Text, z, ii - z)<BR> z = ii + 1<BR> End If<BR> <BR> For Each lay4 In ThisDrawing.Layers<BR> If Mid(lay4.Name, 7) = layname Then<BR> lay4.LayerOn = False<BR> Exit For<BR> End If<BR> Next lay4<BR> Next ii<BR>End Sub</P>
<P>程序运行后有以下问题:1、图层名为单独数字的关不了,如XREF1│9;2、图层名为汉字的关不了,如XREF1│设备。</P>
<P>请高手指点,谢谢!</P> Sub tt()<BR>a = Split("1;2;设备;6;7", ";")<BR>For Each i In a<BR> ThisDrawing.Layers(i).LayerOn = False<BR>Next i<BR>End Sub<BR> 谢谢!
页:
[1]