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