Hello,
I'm writing to Excel in my program successfully, but after I finish, quit Excel and set my variables to nothing in the program's method, the Excel.exe process is still running in Windows. It terminates when I close my program, but not when I try to kill it in the method I'm using. I can't figure out why the Excel.exe is still running. If anyone can help, thanks in advance. Also, the method is running in a thread, so I'm not sure if that has something to do with the problem (the thread is tested and works great).
Here's the code I'm trying to get to work...
Public Sub tryExcel()
Dim objExcel As Object
Dim objBook As Object
Dim objSheet As Object
objExcel = CreateObject("Excel.Application")
objBook = objExcel.Workbooks.Add
objSheet = objBook.Worksheets(1)
objSheet.cells(1, 1) = "Hello World"
objBook.SaveAs("C:\myexcel.xls")
objSheet = Nothing
objBook = Nothing
objExcel.Quit()
objExcel = Nothing
End Sub
I'm writing to Excel in my program successfully, but after I finish, quit Excel and set my variables to nothing in the program's method, the Excel.exe process is still running in Windows. It terminates when I close my program, but not when I try to kill it in the method I'm using. I can't figure out why the Excel.exe is still running. If anyone can help, thanks in advance. Also, the method is running in a thread, so I'm not sure if that has something to do with the problem (the thread is tested and works great).
Here's the code I'm trying to get to work...
Public Sub tryExcel()
Dim objExcel As Object
Dim objBook As Object
Dim objSheet As Object
objExcel = CreateObject("Excel.Application")
objBook = objExcel.Workbooks.Add
objSheet = objBook.Worksheets(1)
objSheet.cells(1, 1) = "Hello World"
objBook.SaveAs("C:\myexcel.xls")
objSheet = Nothing
objBook = Nothing
objExcel.Quit()
objExcel = Nothing
End Sub