13022164437 发表于 2008-11-10 10:34:00

求指正下面程序的错误?

我想当打开cad文件时,自动加载命令,但下面的程序只能在打开第一个文件时加载vba宏,怎样才能每次打开文件时都能加载呢?<br/>Public TestLoad As Boolean<br/>Private Sub AcadDocument_EndCommand(ByVal CommandName As String)<br/>   If Not TestLoad Then<br/>        ThisDrawing.SendCommand "(defun c:bz()(vl-vbarun ""bz"")(princ))(princ)" &amp; vbCr<br/>        ThisDrawing.SendCommand "(defun c:rz()(vl-vbarun ""rz"")(princ))(princ)" &amp; vbCr<br/>       TestLoad = True<br/>   End If<br/>End Sub<br/><br/>

fjfhgdwfn 发表于 2008-11-10 12:16:00

<p>If Not TestLoad Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "(defun c:bz()(vl-vbarun ""bz"")(princ))(princ)" &amp; vbCr<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "(defun c:rz()(vl-vbarun ""rz"")(princ))(princ)" &amp; vbCr<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TestLoad = True</p><p>else</p><p>&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "bz" &amp; vbCr<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisDrawing.SendCommand "rz" &amp; vbCr<br/><br/>&nbsp;&nbsp; End If<br/></p>
页: [1]
查看完整版本: 求指正下面程序的错误?