Can someone please give me a pointer on how to save the output of a shell command issued through Excel VBA to a dump file? I need to be able to analyze the return to continue my program. Thanks.
You'll have to write the redirect string to a batch file,
then shell the batch file
example:
Sub write_batch()
Open ("c:\temp\my_temp.bat" For Output As #1
Print #1, "dir c:\temp >c:\temp\my_temp2.txt"
Close
End Sub
---------------------------
Sub run_bat()
Shell ("c:\temp\my_temp.bat"
End Sub
I seem to recall that you could use something like the following to carry out a DOS command directly from the SHELL command, w/o resorting to batch files:
Code:
Shell("command.com /C dir c:\temp >c:\temp\myTemp.txt")
Also, I have successfully used the following on my new Win 2000 Pro system:
Code:
Shell ("cmd.exe /C dir c:\temp >c:\temp\my_temp.txt")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.