Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Highlight all by clicking in box
Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Const INFINITE = -1
Public Sub ShellWait(ByVal FileName As String, optional WindowStyle As Variant)
Dim idProc As Long
Dim hProc As Long
' start program and save PID
idProc = VBA.Shell(FileName, WindowStyle)
' get process handle
hProc = OpenProcess(PROCESS_ALL_ACCESS, False, idProc)
'wait till program has finished
If hProc <> hNull Then
Call WaitForSingleObject(hProc, INFINITE)
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.