title: Call python script from vba with wsh
body: <p>I need to call a python script from vba which works fine by using the shell.</p>
  
  <pre><code>Sub CallPythonScript()
  
          Call Shell("C:\Program Files (x86)\Python27\python.exe C:\Users\Markus\BrowseDirectory.py")
  
  End Sub
  </code></pre>
  
  <p>But when I try using wsh (because of the wait funcionality) it just won't work anymore. </p>
  
  <pre><code>Sub CallPythonScript()
  
      Dim wsh As Object
          Set wsh = VBA.CreateObject("WScript.Shell")
  
      Dim myApp As String: myApp = "C:\Program Files (x86)\Python27\python.exe C:\Users\Markus\BrowseDirectory.py"
      Dim waitOnReturn As Boolean: waitOnReturn = True
      Dim windowStyle As Integer: windowStyle = 1
  
      wsh.Run """"" &amp; myApp &amp; """"", windowStyle, waitOnReturn
  
  End Sub
  </code></pre>
  
  <p>However, I used the same code at home and everything worked out just fine, with the difference that there weren't any blanks in the path. So naturally there must be something wrong with the blanks. Help is greatly appreciated. </p>