In my program I want to do the following command:
RetVal = Shell("dir > temp", 1)
When I do that I get the following error:
Run-time error "53": File not found.
Just doing Shell("dir", 1) gives me the same error. However, if I do Shell("help", 1), it works.
The dir > temp command works fine in the command window. I tried using Shell with the following commands: dir, cd, ver, time, date, help. The only one of these that works is help.
I expect to get a directory listing when I do Shell("dir > temp", 1) that I can do other things with temp. Instead, I get "File not found".
dir > temp, you may want to specify a full path fortemp. Where the file ends up when running from a command prompt may be different than where it ends up when being executed by your VBA code. It never hurts to be fully explicit.