[求助]在CAD的vba编程中的“me.hide"问题
<p>建立的模块名为模块1,过程名为zfj,全部代码如下</p><p>Public Sub zfj()</p><p>Dim AcadApp As AutoCAD.AcadApplication<br/>Set AcadApp = GetObject(, "AutoCAD.Application")<br/>Dim Mydocument As AcadDocument<br/>Set Mydocument = AcadApp.ActiveDocument<br/>Dim Myentity As AcadPolygonMesh<br/>Dim Mysel As AcadSelectionSet<br/>Dim fil_type(0) As Integer<br/>Dim fil_data(0) As Variant<br/>Dim Mycoordinates As Variant<br/> fil_type(0) = 0<br/> fil_data(0) = "PolygonMesh"<br/>On Error Resume Next</p><p>If Not IsNull(Mydocument.SelectionSets.Item("Mysel")) Then<br/> Set Mysel = Mydocument.SelectionSets.Item("Mysel")<br/> Mysel.Delete<br/>End If<br/>Set Mysel = Mydocument.SelectionSets.Add("Mysel")<br/>Dim i, j, k As Integer<br/>Me.hide<br/>Mysel.SelectOnScreen<br/>Me.show<br/>For Each Myentity In Mysel<br/> Mycoordinates = Myentity.Coordinates<br/>Next<br/>Open "D:\zfj\ory.dat" For Append As #1<br/>For i = 0 To (j * 6 - 1) Step 6<br/>Print #1, "gen zone brick size 1,1,1" & " &"<br/>Print #1, "p0" & "(" & Round(Mycoordinates(i), 4) & "," & Round(Mycoordinates(i + 1), 4) & "," & Round(Mycoordinates(i + 2), 4) & ")&"<br/>Print #1, "p1" & "(" & Round(Mycoordinates(i + 3), 4) & "," & Round(Mycoordinates(i + 4), 4) & "," & Round(Mycoordinates(i + 5), 4) & ")&"<br/>Print #1, "p2" & "(" & Round(Mycoordinates(i), 4) & "," & Round(Mycoordinates(i + 1), 4) & "," & Round((Mycoordinates(i + 2) - 1), 4) & ")&"<br/>Print #1, "p3" & "(" & Round(Mycoordinates(i + 6), 4) & "," & Round(Mycoordinates(i + 7), 4) & "," & Round(Mycoordinates(i + 8), 4) & ")&"<br/>Print #1, "p4" & "(" & Round(Mycoordinates(i + 3), 4) & "," & Round(Mycoordinates(i + 4), 4) & "," & Round(Mycoordinates(i + 5) - 1, 4) & ")&"<br/>Print #1, "p5" & "(" & Round(Mycoordinates(i + 6), 4) & "," & Round(Mycoordinates(i + 7), 4) & "," & Round(Mycoordinates(i + 8) - 1, 4) & ")&"<br/>Print #1, "p6" & "(" & Round(Mycoordinates(i + 9), 4) & "," & Round(Mycoordinates(i + 10), 4) & "," & Round(Mycoordinates(i + 11), 4) & ")&"<br/>Print #1, "p7" & "(" & Round(Mycoordinates(i + 9), 4) & "," & Round(Mycoordinates(i + 10), 4) & "," & Round(Mycoordinates(i + 11) - 1, 4) & ")"<br/>Next<br/>Print #1, ";*****************************"<br/>Close #1<br/>Mysel.Delete</p><p>End Sub</p><p>求助:为何一运行就出现“无效使用 Me 关键字”错误呢?请高人指教,在下不胜感激!<br/></p> <p>模块里那里有me?你是在VB里做的?还是VBA?</p> <p>Me.hide<br/>Me.show</p><p>应该指的是窗体USERFORM,在模块中没用</p> 是在vba里,应该如何改呢? 但是在vb里的话,这段代码不起作用啊 <p>如果VB的话,可以这样</p><p> AppActivate ACadApp.Caption<br/> ss.SelectOnScreen<br/> AppActivate Me.Caption<br/></p><p>VBA里,去掉me.***等</p> <p>用版主所说的方法,会不会出现程序被激活,</p><p>但是不在最前台,而是在任务栏里面黄色的一闪一闪呢?</p>
页:
[1]