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