By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

Become an Σxpert at Σxcel.com

 


ShellAndWait API

Public Sub ShellAndWait(cmdLine As String)

   Dim hProcess As Long
   Dim taskId As Long
  
   taskId = Shell(cmdLine, vbNormalFocus)
  
   hProcess = OpenProcess(SYNCHRONIZE, True, taskId)
   Call WaitForSingleObject(hProcess, WAIT_INFINITE)
   CloseHandle hProcess

End Sub