I tried your code because it looks
quite new to me. (And I'm out of idea).
But can you indicate how I should define
theses variables objSWbem, colProcesses and
colProcesses.
I drove some tests at several places :
Public objSWbem As Object
Public colProcesses As Object
Public objProcess As Object
And also I defined them as variant.
But no chance : no errors at all, and the
!!%('$;!+) WINWORD.EXE is still there.
Thank you anyhow, and many thanks if
you follow this post.
Cordially.
Patrick
"urkec" <(E-Mail Removed)> a écrit dans le message de news:
73FC99CB-EDCC-49BA-920C-(E-Mail Removed)...
> "Patrick Penet" wrote:
>
>> No way !
>> This stupid WINWORD.EXE is still here.
>>
>> I will search around for some APIs, I think I
>> remember one was doing the job.
>>
>
> Try this code to kill all WINWORD.EXE processes created by embedded objects:
>
> Set objSWbem = CreateObject("winmgmts:root\cimv2")
> Set colProcesses = objSWbem.ExecQuery _
> ("Select * From Win32_Process " & _
> "Where Name='WINWORD.EXE' " & _
> "And CommandLine Like '%-Embedding%'")
>
> For Each objProcess In colProcesses
> objProcess.Terminate
> Next
>
>
> --
> urkec