0

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 Answer 1

7

Use xls.Quit after you close the workbook

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks ! I looked for Destroy, Exit, Close...all except the obvious QUIT. Thank you so much.
it's also prompting me to overwrite the prev excel file on this line of code: wb.SaveAs fullFilePath, AccessMode:=xlExclusive . I've tried to turn off alerts but this line doesn't work for this: Application.DisplayAlerts = False
Which version of Excel, just tried it with 2010 and it works for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.