Option Explicit Dim AcadApp As AutoCAD.AcadApplication
On Error Resume Next Set AcadApp = GetObject("AutoCAD.Application") 此处错误提示:自动化操作时文件名或者类名没有找到 If Err.Number Then Err.Clear AcadApp = CreateObject("AutoCAD.Application") If Err.Number Then MsgBox "无法打开Autocad" & Err.Description 此处错误提示:对象变量或with块变量未设置
unload me Exit Sub End If End If
AcadApp.Visible = True AcadApp.WindowState = acMax AppActivate AcadApp.Caption End Sub
但是当我没有打开cad时,用set acadapp=new acadappplication 可以打开cad ,请高手指点,谢谢!