我用的是XP系统,VB6.0和AutoCAD2005,为何用VB连接不上CAD,望赐教,谢过先!
Public acadApp As AcadApplication Public acadDoc As Object Public moSpace As Object Public paSpace As Object
Sub main()
On Error Resume Next Set acadApp = GetObject(, "AutoCAD.Application") If Err Then Err.Clear Set acadApp = CreateObject("AutoCAD.Application") If Err Then MsgBox Err.Description Exit Sub End If End If Set acadDoc = acadApp.ActiveDocument Set moSpace = acadDoc.ModelSpace Set paSpace = acadDoc.PaperSpace acadApp.Visible = acTrue Form1.Show
End Sub 下面是我相关图片: