title: VBA: Execute .bat file, hide the command prompt and continue code when .bat has completed
body: <p>I have this piece of VBA which runs a .bat file and waits for it to complete before closing it and moving to "do stuff":</p>
  
  <pre><code>Sub RunFWScript()
  
  Dim waitOnReturn As Boolean: waitOnReturn = True
  Dim windowStyle As Integer: windowStyle = 1
  
  CreateObject("WScript.Shell").Run ("cmd /c pushd FilePath &amp; filename.bat"), windowStyle, waitOnReturn
  
  'do stuff
  
  End Sub
  </code></pre>
  
  <p>If I replace "windowStyle, waitOnReturn" with "vbhide", I have a macro which runs the .bat file without showing the user the command prompt screen, however it immediately moves to "do stuff", not waiting the .bat to finish.</p>
  
  <p>Ideally I'd like the command prompt to be hidden AND to wait on the .bat before moving to the next part of my VBA. My problem is that when I try to combine these two, i.e. go with ", vbHide, windowStyle, waitOnReturn", I get an error </p>
  
  <p>"Run-time error '450':
  Wrong number of arguments or invalid property assignment."
   Is there a way of getting these 3 commands in without error?</p>