I have a simple procedure that opens an Excel workbook (Excel 10) and updates it. However even after Closing, Quiting and setting all objects to nothing the Excel process does not shut down - until the VB application is closed.
I was able to replicate the problem with this code which does nothing more than open the book and reference some objects.
VB Code:
Dim objExcel As Excel.Application Dim objBook As Excel.Workbook Dim objSheet As Excel.Worksheet Dim objRange As Range Set objExcel = New Excel.Application Set objBook = objExcel.Workbooks.Open("C:\Testing.xls") Set objSheet = objBook.Worksheets(1) Set objRange = objSheet.Range(Cells(1, 1), Cells(1, 2)) Set objRange = Nothing Set objSheet = Nothing objBook.Close False Set objBook = Nothing objExcel.Quit Set objExcel = Nothing
The Excel process will shutdown if I comment out this line
Set objRange = objSheet.Range(Cells(1, 1), Cells(1, 2))
Something about that Range object is keeping Excel alive. Is there another method I should be using that will release the Range object? Setting it to nothing does not work.




Reply With Quote