Autocad调用Excel时,其经典语句组合是 Dim xlApp As Object ' This Line ,Not set Excel , run Excel 'Dim xlsheet As Object ' 发生错误时跳到下一个语句继续执行 On Error Resume Next ' 连接Excel应用程序 Set xlApp = GetObject(, "Excel.Application") If Err.Number <> 0 Then Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlApp.Workbooks.Add End If ' 返回当前活动的工作表 Set xlSheet = xlApp.ActiveSheet
|