Module:
VB Code:
  1. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  2. Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
  3. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  4. Const STILL_ACTIVE = &H103
  5. Const PROCESS_QUERY_INFORMATION = &H400
  6.  
  7. Sub Shell32Bit(ByVal jobtodo As String)
  8.          Dim hProcess As Long
  9.          Dim RetVal As Long
  10.           'captures process ID
  11.          hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(jobtodo, 0))
  12.              
  13.          Do
  14.  
  15.              'Get the status of the process
  16.              GetExitCodeProcess hProcess, RetVal
  17.  
  18.              'Sleep command recommended as well as DoEvents
  19.              DoEvents: Sleep 100
  20.                    
  21.  
  22.          'Loop while the process is active
  23.          Loop While RetVal = STILL_ACTIVE
  24. End Sub

usage:
VB Code:
  1. Call Shell32Bit("C:\ExsternalApp.exe")