Hello Dear Excel programmers! Please tell me how to fix the code below (excel 2003 vba) so that the third-party application “v5.exe” launched from the book from List1 opens as a modal window "froze" all actions with the book until the process "v5.exe" is completed (win xp and win 7)? In other words, how to run the application "v5.exe" (this is a window with fields) as a regular excel form? Thank!

Dim MyPath MyPath = Shell(Environ("temp") & "\" & "v5.exe " & Chr(34) & ThisWorkbook.FullName & Chr(34), 1) 
  • Will not work. Excel will hang while waiting. - Qwertiy

1 answer 1

Use Windows Script Host
use WScript.Shell :

 Dim FullPath As String Dim wsh As Object Dim waitOnReturn As Boolean Dim windowStyle As Integer Set wsh = VBA.CreateObject("WScript.Shell") waitOnReturn = True windowStyle = 1 FullPath = Environ("temp") & "\" & "v5.exe " & Chr(34) & ThisWorkbook.FullName & Chr(34) wsh.Run FullPath, windowStyle, waitOnReturn MsgBox "End v5.exe" 
  • Thank you very much, I will try. - olga
  • @olga Write if you have any problems - Sublihim
  • I tried the code above: when launching the "v5.exe" application, the excel book as if hangs, but responds to pressing, i.e. if you click on the cross to close the excel workbook, then after the completion of the "v5.exe" process, the book closes, which would not be desirable. Maybe it is possible to start the modal excel form (userform1.show 1) with the "v5.exe" application in some way in the background, and unload the form after the "v5.exe" process is completed? Thank! - olga
  • @olga. No, unless you, yourself, in any way do not block the whole Excel. Judge for yourself, you are from one process, start another process and this, if it is still primitive to consider. Here you can show the modal form from VBA - you can. And, from there, you can try and call the above code - Sublihim
  • Thank you very much! - olga