Excel won't quit from VB.NET
I rearranged your code slightly and I don't get excel process still running
when I do it this way:
Private ExcelApp As Excel.Application
Private oBooks As Excel.Workbook
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button1.Click
ExcelApp = New Excel.Application
ExcelApp.Visible = True
oBooks = ExcelApp.Workbooks.Open("C:\Book1.xls")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button2.Click
ExcelApp.Workbooks.Close() '(or Wb.Close)
ExcelApp.Quit()
End Sub
HTH,
Dave
"Atchoum" wrote:
I've read zillions of threads on this and can't figure out why Excel process
is still running. Can someone help?
Private ExcelApp As Excel.Application
Private oBooks As Excel.Workbook
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
CreateObject("Excel.Application")
Wb = ExcelApp.Workbooks.Open("C:\Book1.xls")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ExcelApp.Workbooks.Close() '(or Wb.Close)
ExcelApp.Quit
End Sub
I don't get why even after ExcelApp.Quit, Excel.exe still appears in task
manager...
Atchoum
|