0
votes

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. i.e. Windows Task Manager shows the Process as "EXCEL.EXE *32", even after I've closed Excel.

Here's some code below :

Public Sub Test Dim xls As Object

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. And as I've stated above, it causes EXCEL.EXE *32 to live on as a windows process.

thanks in advance.... Bob

1

1 Answers

6
votes

Use xls.Quit after you close the workbook