Public acadApp As Object Public acadDoc As Object Private Sub Command1_Click() On Error GoTo L: GetACDoc Dim entHandle As String Dim strcmd As String entHandle = "8E8E" acadDoc.SendCommand "LineToPline " strcmd = "(Handent""" & entHandle & """)" acadDoc.SendCommand strcmd & " " & vbCrLf acadDoc.SendCommand vbCrLf Exit Sub L: MsgBox Err.Description End Sub '————————————————————————————— '名称:GetACDoc '作者:罗简单 '日期:2009-1-13 '功能:获取当前文件 '————————————————————————————— Public Sub GetACDoc() '获取CASS程序和当前Document Set acadApp = GetObject(, "AutoCAD.Application") Set acadDoc = acadApp.ActiveDocument End Sub 上面的代码执行到 acadDoc.SendCommand "LineToPline " 时就要求在图上选择对象呢,停住了 但是我 strcmd = "(Handent""" & entHandle & """)" acadDoc.SendCommand strcmd & " " & vbCrLf 代码就是选择对象 啊 我想让直接在程序里通过句柄来选择对象,怎么解决
上面的代码如果直接在VBA里运行是可以的,但是如果用VB来调用CAD的话 就要求在图上选择对象。 哪位高人指点一下啊!
|