G
Guest
I am doing Excel Automation and I notice that when I close the Excel window
launched from my main form, EXCEL.EXE still remains in my Task Manager. I
have a cleanup routine in my main form which kills the Excel process when my
main form is closed. But, I would like the ability to detect when the user is
closing the Excel window without closing the main form and still be able to
run the cleanup function. Is there a way to detect such window closing event?
If not, I can disable the close button for the Excel window, but users would
still be able to use the File>Exit menu item to close. In that case, I would
like to change the behavior of the Exit menu item so that I can run my clean
up function when File>Exit is clicked. Is it possible to do so?
I am using C#, but VBA sample code would be helpful too.
Thank you so much.
launched from my main form, EXCEL.EXE still remains in my Task Manager. I
have a cleanup routine in my main form which kills the Excel process when my
main form is closed. But, I would like the ability to detect when the user is
closing the Excel window without closing the main form and still be able to
run the cleanup function. Is there a way to detect such window closing event?
If not, I can disable the close button for the Excel window, but users would
still be able to use the File>Exit menu item to close. In that case, I would
like to change the behavior of the Exit menu item so that I can run my clean
up function when File>Exit is clicked. Is it possible to do so?
I am using C#, but VBA sample code would be helpful too.
Thank you so much.