[英]In Excel VBA 2010: How to destroy excel vba.application object
I have an Excel.Application object which seems to live on as a Windows Process AFTER my VBA code has executed and Excel 2010 is completely closed out. 我有一个Excel.Application对象,该对象似乎在执行我的VBA代码并且完全关闭Excel 2010之后仍作为Windows进程存在。 ie Windows Task Manager shows the Process as "EXCEL.EXE *32", even after I've closed Excel. 即即使关闭了Excel,Windows任务管理器也将进程显示为“ EXCEL.EXE * 32”。
Here's some code below : 下面是一些代码:
Public Sub Test Dim xls As Object 公开子测试Dim xls作为对象
Set xls = CreateObject("Excel.Application")
Set wb = xls.Workbooks.Add
fullFilePath = importFolderPath & "\" & "A1"
wb.SaveAs fullFilePath, AccessMode:=xlExclusive ' SAVE WORKBOOK AND CLOSE !
wb.Close (True)
' question: How can I destroy the xls object ????
end sub 结束子
Basically I can't figure out how to destroy the "xls" I've created in my code. 基本上,我不知道如何销毁我在代码中创建的“ xls”。 And as I've stated above, it causes EXCEL.EXE *32 to live on as a windows process. 就像我上面说的,它使EXCEL.EXE * 32作为Windows进程存在。
thanks in advance.... Bob 预先感谢...。鲍勃
关闭工作簿后使用xls.Quit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.