getting vba shell command to execute batch and save output to a file
- From: "Mad Scientist Jr" <usenet_daughter@xxxxxxxxx>
- Date: 27 Apr 2006 09:44:12 -0700
I have a batch file I would like to execute from an Excel macro, and
have the output be piped to a file. For this test I created a file
"dir.bat" in the same folder as "Book1.xls", the file contains one
line, "dir /b /o"
From the command prompt, if I run it like so
dir.bat > dir.txt
it successfully saves the directory listing to "dir.txt".
However it doesn't seem to be working from the Excel macro:
Sub ShellTest()
Shell ThisWorkbook.Path & "\dir.bat > dir.txt"
End Sub
I get no error messages, and dir.txt gets created, but it is empty.
Can anyone see anything wrong?
Much appreciated...
.
- Prev by Date: Re: button that opens open dialogs but saves path to ***
- Next by Date: RE: Need help coping a range of data from *** 1 to the next empty c
- Previous by thread: Workbook not closed when OnBeginShutdown and OnDisconnection events fire in Excel Addin
- Next by thread: Re: getting vba shell command to execute batch and save output to a fi
- Index(es):