I am building an application that reads an excel file and inputs the information into the application for further use, when I finished using the excel object I close but the process is still alive, so I commented everything in my code and just left the following
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
oXL = CreateObject("Excel.Application")
oXL.Workbooks.Open(FilePath.Text)
oWB.Close()
oXL.Quit()
oWB = Nothing
oXL = Nothing
But still the process stays alive until I close my entire application. The code that you see above is run in a sub inside of a child window. I was also trying to see if oXL.hwnd will some how help me identify the process so I could kill it using the process class but no luck. So finally I just used some methods of the process class to kill a Excel process that it finds, wich is all good if only one Excel process is running in the computer but if more than one is running I could get into trouble closing something that I should not.
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
oXL = CreateObject("Excel.Application")
oXL.Workbooks.Open(FilePath.Text)
oWB.Close()
oXL.Quit()
oWB = Nothing
oXL = Nothing
But still the process stays alive until I close my entire application. The code that you see above is run in a sub inside of a child window. I was also trying to see if oXL.hwnd will some how help me identify the process so I could kill it using the process class but no luck. So finally I just used some methods of the process class to kill a Excel process that it finds, wich is all good if only one Excel process is running in the computer but if more than one is running I could get into trouble closing something that I should not.