ID: 148
Viewed: 3520
Added: Apr 28, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
none
Highlight all by clicking in box
<!---Declaration--->
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)
Call CloseHandle(hProc)
End If
End Sub
Highlight All
<!---Code--->
none;
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.