本帖最后由 Flyingdancing 于 2012-11-13 12:39 编辑
- Sub sd()
- Dim cad As Object
- Dim ex As Object
- '先打开一个EXCEL
- Set ex = GetObject(, "excel.application")
- ex.Application.Visible = False
- 'EXCEL不可见
- '新建EXCEL
- Set ex = CreateObject("excel.application")
- ex.Application.Visible = True
- 'EXCEL可见
- '具体区别可查看任务管理器,进程有两个EXCEL任务
- Set cad = GetObject(, "autocad.application")
- cad.Application.Visible = False
- ex.Application.Quit
- Set ex = Nothing 'set必须有才能退出
- '只能退出一个EXCEL进程
- cad.Application.Quit
- Set cad = Nothing
- '退出CAD
- End Sub
|