'先引用AutoCAD类型库 Sub bb() Dim acadApp As AcadApplication Dim acadDocs As AcadDocuments Dim acadDoc As AcadDocument 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 acadApp.Visible = True acadApp.WindowState = acMax Set acadDocs = acadApp.Documents acadDocs.Add Set acadDoc = acadApp.ActiveDocument acadDoc.WindowState = acMax End Sub |