Forum Discussion

cindy_lu's avatar
cindy_lu
Copper Contributor
Jul 14, 2022
Solved

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

 

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.

 

.

  • cindy_lu 

     

    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.

3 Replies

  • Jagodragon's avatar
    Jagodragon
    Iron Contributor

    cindy_lu 

     

    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.

    • cindy_lu's avatar
      cindy_lu
      Copper Contributor
      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
      • Jagodragon's avatar
        Jagodragon
        Iron Contributor
        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.

Resources