tohell 发表于 2009-11-3 09:04:00

Getentity方法错误

<p>VBA代码:</p><p>Public Sub SelectAndCopy()<br/>&nbsp;&nbsp;&nbsp; Dim returnObj As AcadObject<br/>&nbsp;&nbsp;&nbsp; Dim bassPnt As Variant<br/>&nbsp;&nbsp;&nbsp; <br/>RETRY:<br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Utility.GetEntity returnObj, bassPnt, "请选取一个对象"<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; If Err &lt;&gt; 0 Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox ThisDrawing.GetVariable("lastprompt")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Err.Clear<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Sub<br/>&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox returnObj.EntityName<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; GoTo RETRY<br/>End Sub<br/></p><p>宏运行后点击对象时正常运行,但是点击空地方或按ESC键时提示Getentity方法出错,宏直接退出运行,而没有进入错误处理程序</p><p>弹出对话框提示:运行时错误‘-2147352567(80020009)’:方法‘Getentity’作用于对象‘IAcadUtility’时失败</p><p></p><p></p>

tohell 发表于 2009-11-3 09:30:00

function XML() {
   
}

wylong 发表于 2009-11-3 11:23:00

建议你看一下置顶的&nbsp; <div class="listtitle"><a title="《请问:用getpoint操作时,怎样进行平移缩放及右键结束》
作者:zgyxn
发表于:2003-4-7 20:42:00
最后发贴:我的方法:注:研..." href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=5682"><font color="#000000">请问:用getpoint操作时,怎样进行平移缩放及右键结束</font></a></div>

home 发表于 2009-11-3 17:17:00

<p>On Error Resume Next</p><p>这一句很重要哦</p>
页: [1]
查看完整版本: Getentity方法错误