title: Wait for shell command to complete
body: <p>I'm running a simple shell command in Excel VBA that runs a batch file in a specified directory like below: </p>
  
  <pre><code>Dim strBatchName As String
  strBatchName = "C:\folder\runbat.bat"
  Shell strBatchName
  </code></pre>
  
  <p>Sometimes the batch file might take longer on some computer to run, and there are proceeding VBA code that is dependent on the batch file to finish running. I know you can set a wait timer like below:</p>
  
  <pre><code>Application.Wait Now + TimeSerial(0, 0, 5)
  </code></pre>
  
  <p>But that might not work on some computer that are too slow. Is there a way to systematically tell Excel to proceed with the rest of the VBA code until <em>after</em> the shell has finish running?</p>