There is no "wait parameter" for the Shell command; however, you can make
your code wait using some simple Windows API calls. Follow these
instructions to see how...
Go to the VBA editor and add a Module (Insert/Module from the menu bar) and
then copy/paste these lines in its (General)(Declarations) section:
Public Declare Function OpenProcess _
Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Public Declare Function CloseHandle _
Lib "kernel32" _
(ByVal hObject As Long) As Long
Public Declare Function WaitForSingleObject _
Lib "kernel32" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Now, in your own code, call your Shell command in this format with the
appropriate Shell arguments placed in the parentheses:
PID = Shell( <<Put Shell Arguments Here>> )
Next, paste the following IMMEDIATELY after the PID=Shell statement above
(making sure to handle the possible error where indicated; i.e. stop the
code from falling through to your other commands if the Shell failed):
If PID = 0 Then
'
'Handle Error, Shell Didn't Work
'
Else
hProcess = OpenProcess(&H100000, True, PID)
WaitForSingleObject hProcess, -1
CloseHandle hProcess
End If
And finally, Dim both the PID and hProcess variables as Long. Now, when you
run your code, it will wait for the Shell command to finish (if you are
actually opening the Command Window, your code will wait for you to Exit
from it).