Sub ConnectCAD() '连接到AutoCAD Dim AcadApp As Object '定义一个对象 On Error Resume Next Set AcadApp = GetObject(, "AutoCAD.Application") If Err Then '如果没有一个AutoCAD副本在运行 Err.Clear Set AcadApp = CreateObject("AutoCAD.Application") AcadApp.Visable = True '启动一个AutoCAD副本并设为可见 If Err Then MsgBox Err.Description '如果失败,给出错误提示 Exit Sub End If End If End Sub