Use Querytable in VBA, process exists even after delete all connections and querytable.

Occasional Contributor


UPDATE: Thanks to @Jagodragon which provide a way to kill all the processes created by QueryTable method. However, it would be great if I can know why these processes are generated; Also, if killing all the processes is the only solution, is it safe to kill all of them?

Question: Hello, I am using QueryTable to import csv files in VBA macro.

My Macro delete all connections and Querytables after importing the csv files.
However, even if I close the workbook that contains the macro I used, as long as I left other excel workbooks open, the Console Window Host and the Mashup Container keep existing.


How can I properly delete all the console window host??

Thanks in advance.




3 Replies
best response confirmed by cindy_lu (Occasional Contributor)



you can try using this in your VBA code

Shell "taskkill.exe /f /t /im Microsoft.Mashup.Container.Loader.exe"

it should kill all the instances of the process "Microsoft.Mashup.Container.Loader.exe"


This is not my code. I just knew i'd seen it before and did a google search.

Good luck.

Thanks! This really works.
However, I believe that it will also delete other Processes which are not created by the macro I had run. (For example, other macros also utilize QueryTable and left something like this.)

Is there any possible way to fetch the PIDs and kill those processed more specifically?
I am using `ActiveSheet.ListObjects.Add` method
I do not believe that it is possible to filter the PID get process results in a way that would allow you to strip the correct PID from the correct process.

perhaps some one with more experience can help with this. but i do not think it is possible.