View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
chijanzen chijanzen is offline
external usenet poster
 
Posts: 139
Default How to Close an application?

Hi ,Avi

try it!

close the Windows after 10 seconds

Sub LaunchCaptureExpress()
Dim WshShell As Object
Dim oExec As Object
Set WshShell = CreateObject("Wscript.Shell")
Set oExec = WshShell.Exec("C:\Program Files\Capture Express\capexp.exe")
DoEvents
Application.Wait (Now + TimeValue("0:00:10"))
oExec.Terminate
Set WshShell = Nothing
Set oExec = Nothing
End Sub

--
http://www.vba.com.tw/plog/


"Avi" wrote:

Hello,

I open an application via this code thaht works fine
Sub LaunchCaptureExpress()
Dim RetVal As Long
RetVal = Shell("C:\Program Files\Capture
Express\capexp.exe", vbNormalFocus)
End Sub

How do i close it???

Thanks a lot


Avi
www.avibenita.com