Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 148
Viewed: 2971
Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty


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)
Call CloseHandle(hProc)
End If

End Sub

Highlight All

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

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.

© 2002 - 2018 All Rights Reserved. Conditions