• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Kill a Task Manager Child Process using VBA

inddon

Member
Hello There,

I would like to know how to kill a Task Manager's process using excel vba.
I am using 2 files:
1. File 2 Donnie Working All.xlsm
2. Piramide Database.xlsx

I would like to have the vba code in the following manner:

1. Check if there are any Excel Task Manager process running.
2. If yes then loop to further check:
--if the child process name includes the above file names
3. If yes, then kill it
4. If there are no child process remaining then kill the parent

I have snapshot attached as an example for your reference.

Look forward to hearing from you.

Thank you & regards,
Don
 

Attachments

  • Kill Process specific task.JPG
    Kill Process specific task.JPG
    31.9 KB · Views: 8
Can I ask why you need to do this?

Thank you for your question.

The first workbook opens the second workbook.

Sometimes, when the workbook crashes the child process still remains active in the Task Manager.
When you open the workbook (after the crash), then it says the first workbook is open, to be open in read-only mode.

Therefore, in the first Workbook open sub I want to check if the second work book is active in the Task manager as a child process and kill it accordingly. Then the subsequent code thereafter handles the opening of the second workbook

Regards,
Don
 
Then you can probably just use Getobject with the full path to the second workbook. It will either grab a reference to it if already open, or open it if not.
 
Thank you Debaser for your reply.

I didn't understand. Could you please let me know how this can be done in VBA?

When I open the second workbook, I do open it with full path with write mode.
But before opening it I would like to check if it is already open, if yes then kill it's process and then open it in write mode.

Regards,
Don
 
Back
Top