设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

在Access中调用Excel无法彻底关闭

1970-1-1 08:00| 发布者: 未知| 查看: 2099| 评论: 0


Office 组件都有一个 Quit 方法,直接调用 Quit 方法可以彻底退出该程序
以下以Excel为例子:
Function Automation_To_Excel()
    Dim objExcel As Object
   
    ' Create a new instance of Excel.
    Set objExcel = CreateObject("Excel.Application")
   
    ' Show the instance of Excel on the screen.
    objExcel.Visible = True
   
    ' Open a file named SampleFile.xls
    objExcel.Workbooks.Open ("C:\My Documents\SampleFile.xls")
   
    ' Explicitly close the instance of Excel to free up memory
    ' and set the variable to Nothing to free up the name
    ' space in Access.
    objExcel.Quit
    Set objExcel = Nothing
End Function

最新评论

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-29 10:41 , Processed in 0.077703 second(s), 16 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部