-
July 19th, 2021, 04:33 AM
#1
How to kill Excel process?
Hi,
I'm doing an action in first debug like this:
1, Create excel instance.
2, During debugging, turn it off suddenly.
In some case, this processes still run in background,
so when i use getobject code get the instance but now they are no longer valid.
I used the following code in second debug but it doesn't work?
//check [getobject] if catch error then terminate process and create new one:
::PostMessage(hWnd, WM_CLOSE, 0, 0);
How do I kill this process?
Thanks you!
Last edited by Dang.D.Khanh; July 19th, 2021 at 04:38 AM.
-
July 19th, 2021, 05:25 AM
#2
Re: How to kill Excel process?
How do you obtain the window handle (hWnd)?
If this handle is not valid or the window does not exist then the only way "to kill" is to call TerminateProcess. However, you need to know the process handle of the Excel process.
Victor Nijegorodov
-
July 19th, 2021, 01:55 PM
#3
Re: How to kill Excel process?
Thanks Sir,
I'm trying your suggestion.
-
July 19th, 2021, 08:02 PM
#4
Re: How to kill Excel process?
1, Create excel instance.
How do you create the Excel instance? Do you use CreateProcess? Are you loading it as a COM server using COM?
-
July 20th, 2021, 04:50 AM
#5
Re: How to kill Excel process?
Originally Posted by Arjay
How do you create the Excel instance? Do you use CreateProcess? Are you loading it as a COM server using COM?
Hi Sir,
I'm using CreateInstance function from automate.
I'm still investigating it. for the time being, I will monitor taskmanager and end this task manually if I get this case.
-
July 20th, 2021, 04:54 AM
#6
Re: How to kill Excel process?
Originally Posted by Dang.D.Khanh
Hi Sir,
I'm using CreateInstance function from automate.
I'm still investigating it. for the time being, I will monitor taskmanager and end this task manually if I get this case.
Could you provide some code snippets with "using CreateInstance" and so on?
And the same - for your "close procedure".
Victor Nijegorodov
-
July 20th, 2021, 05:07 AM
#7
Re: How to kill Excel process?
Originally Posted by VictorN
Could you provide some code snippets with "using CreateInstance" and so on?
And the same - for your "close procedure".
I'm using the code from this post,
From old posts I see it's name is CreateDispatch but when I use it I see only name CreateInstance.
I'm trying this answer, it might help me
Last edited by Dang.D.Khanh; August 16th, 2021 at 11:58 AM.
-
July 20th, 2021, 02:28 PM
#8
Re: How to kill Excel process?
Originally Posted by Dang.D.Khanh
I'm using the code from this post,
From old posts I see it's name is CreateDispatch but when I use it I see only name CreateInstance.
I'm trying this answer, it might help me
Try calling Quit.
-
July 20th, 2021, 07:38 PM
#9
Re: How to kill Excel process?
Originally Posted by Arjay
Try calling Quit.
Thanks sir, I think it is a solution that works in most cases.
my problem is solved .
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|