title: Redirecting input to an executable from Excel VBA
body: <p>How do you redirect input to an executable from inside VBA? Specifically, why does the code below not work?</p>
  
  <pre><code>ChDir theRightDirectory
  Set WshShell = VBA.CreateObject("WScript.Shell") 
  WshShell.Run "runme &lt; start.txt", 1, True
  </code></pre>
  
  <p>Or  </p>
  
  <pre><code>RetVal = Shell("runme &lt; start.txt", vbNormalFocus)  
  </code></pre>
  
  <p><code>runme.exe</code> does start up all right, but the input is not redirected and has to be type in manually in the command window. Also tried:</p>
  
  <pre><code>RetVal = Shell("type start.txt | runme.exe", vbNormalFocus)
  </code></pre>
  
  <p>Piping the output of <code>type start.txt</code> into <code>runme.exe</code> just plain returns a “file not found” error. </p>
  
  <p>Yet when I type those various commands directly at the command line, they all work. </p>