请问如果区分?
上次版主给我的建议,但我还是有点搞不出来,那个平移和右键的贴子也看了,我用不上On Error Resume Next
abc_text = ""
Do While InStr(abc_text, "*取消*") = 0
ThisDrawing.Utility.GetEntity adTextobj, 0, "请选择原文字:"
abc_text = ThisDrawing.GetVariable("lastprompt")
'下面这句不行,不管我选择了文字没有,都会执行 if...then 里面的语句
要是有一个语句来判断adtextobj是否包函对像就OK了,但我不知道用什么语句
If adTextobj.ObjectName = "AcDbText" Or adTextobj.ObjectName = "AcDbMText" Then
abc_text = "*取消*"
End If
Loop
这样写吧
Sub SelectText()On Error Resume Next
Dim adTextobj As AcadEntity
Do
ThisDrawing.Utility.GetEntity adTextobj, 0, "请选择原文字:"
If Err Then
Debug.Print ThisDrawing.GetVariable("lastprompt")
If InStr(ThisDrawing.GetVariable("lastprompt"), "*取消*") <> 0 Then
Exit Sub
End If
Else
If adTextobj.ObjectName = "AcDbText" Or _
adTextobj.ObjectName = "AcDbMText" Then
Exit Do
End If
End If
Loop
End Sub
页:
[1]