joek
06-23-2004, 11:02 AM
I bring up Excel w/ VBNet. If the user Exits Excel, I cannot detect this and although the user exited and excel is no longer visible, the system does not give an exception until Excel is terminated through the Task Manager.
How can I tell if Excel is no longer running and why do I need to go to the Task Manager to really kill the Excel process?
for example:
Dim xlapp As Excel.Application
Dim xlwbBook As Excel.Workbook
xlapp = CreateObject("Excel.Application")
xlwbBook = xlapp.Workbooks.Open("c:\VBExtreme.xls")
senario-1 - user exits excel
Try
if xlapp.workbooks.count < 1 then >> this does not cause an exception
senario-2 - after #1, Excel is terminated in the Task Manager
Try
if xlapp.workbooks.count < 1 then >> this does cause an exception
Thanks,
JoeK
How can I tell if Excel is no longer running and why do I need to go to the Task Manager to really kill the Excel process?
for example:
Dim xlapp As Excel.Application
Dim xlwbBook As Excel.Workbook
xlapp = CreateObject("Excel.Application")
xlwbBook = xlapp.Workbooks.Open("c:\VBExtreme.xls")
senario-1 - user exits excel
Try
if xlapp.workbooks.count < 1 then >> this does not cause an exception
senario-2 - after #1, Excel is terminated in the Task Manager
Try
if xlapp.workbooks.count < 1 then >> this does cause an exception
Thanks,
JoeK