nhbabc 发表于 2015-7-1 22:34:02

如何判断getentity 未选择图形对象

各位:   Dim returnobj As AcadObject
         Dim basepnt As Variant
         ThisDrawing.Utility.GetEntity returnobj, basepnt, "select file name to save"
在提示“select file name to save"”若用户未选择图形对象,点了空白处会出错。
   出错对话框如下:file:///

如何判读用户未点选图形对象呢 ?好进行后面的容错处理!

zzyong00 发表于 2015-7-2 22:54:21

判断哪个错误号,以确定就是“用户未选择图形对象”

zzyong00 发表于 2015-7-2 22:54:56

on error goto err1



exit sub
err1
.......

nhbabc 发表于 2015-7-3 08:05:46

试试看,谢谢!

nhbabc 发表于 2015-7-8 19:48:23

还是没用啊,

zzyong00 发表于 2015-7-8 23:27:32


Public Sub ss()
On Error GoTo err1

    Dim returnobj As AcadObject
    Dim basepnt As Variant
    ThisDrawing.Utility.GetEntity returnobj, basepnt, "select file name to save"

Exit Sub
err1:
If Err.Number = -2147352567 Then MsgBox "没选择对象"

End Sub
页: [1]
查看完整版本: 如何判断getentity 未选择图形对象