Is it possible to close a program window, after opening it
with the shell command in vba?.

Re: Close Program by Perry

Perry
Fri Feb 20 11:33:45 CST 2004

You can't ... Shell() doesn't return a handle of use.

Workarounds:
You could run through the Tasks collection like in:
Dim t As Task
For Each t In Tasks
Debug.Print t.Name
If t.Name = "bla" Then t.Close
Next

I wud favour using a couple of API calls to accurately determine
the process(thread) and really terminate the process of your choosing.

Use Google to get more info on:

Private Declare Function TerminateProcess Lib "kernel32" _
(ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

and the accompanying other API calls needed to accurately terminate
processes/applications.

Krgrds,
Perry

"mark" <mark.bzowski@ntlworld.com> schreef in bericht
news:MEmZb.15$b_4.0@newsfe1-win...
> Is it possible to close a program window, after opening it
> with the shell command in vba?.
>
>