Excel process running after closing instance

#1
Hi,
I have a problem when trying to close Excel. When I use MS Excel VBO::Close Instance, the Excel would close, but process in Task Manager is still seen running. The same goes when using MS Excel VBO::Close All Instances.
Process:
- Export table from 3rd party program. Program opens MS Excel (creating one process in Task Manager).
- Using MS Excel VBO::Attach to attach to opened Excel (I would love to use Attach to Workbook, but part of the Workbook's name is changing randomly whenever opened).
- Using MS Excel VBO::Get Worksheet As Collection to read the table.
- Using MS ExcelVBO::Close Instance to close Workbook and Excel at once (no need to save it).
Problem:
After using Close Instance, the Excel is closed but I can still see the process running in Task Manager. I can kill it with Kill Process, but next time I open the Excel it is in some kind of recovery mode letting you know that the Excel was not properly closed and there some backup Workbook saved if needed. I also tried Close All Instances, but this doesn't work either.
If the instance is not closed properly, next time I try to export data this way, I am not able to attach since there is more than one instance running in background.

Any idea why the action is not working? Maybe some workaround? Help! Please :)
 
#2
After you get the worksheet as a collection, try using Close Current Workbook in the Excel VBO using the Handle you got when you Attached to it. Then, do the Close Instance with the same handle. See if that helps you.
 
#3
After you get the worksheet as a collection, try using Close Current Workbook in the Excel VBO using the Handle you got when you Attached to it. Then, do the Close Instance with the same handle. See if that helps you.
Hi, already tried that and the instance is still not closed properly. But what I have found out is that the process disappear after few minutes from Task Manager. So maybe the instance closing works, but with delay (although this has never happened before and is not happening in any other process I have).

So far, my workaround is this:
- Create Excel instance
- Export desired table (this opens Excel Workbook in my already opened instance)
- Get Worksheet, Close Workbook, Close Instance
The process is still running in Task Manager, but next time I want to export data, it opens in instance I already have control over and I don't need to attach to unknown workbook.
 
#4
After you close all instances of Excel, check if the Excel process is still running. If it is, retry a few times with a wait in the retry loop. Give it a maximum number of retries. If it's still running after the retry loop maxes out, then Kill Process "EXCEL".
 
Top