Tom,
The example below is an example of a technique that might work for you. In
the example, I use the Exec method of the WScript.Shell object to capture
the output of a program that would typically print to the console screen (in
my example, I use ipconfig). The example simply reads the text stream
output line by line and places the output in Column A of the active sheet
but you could easily use the filesystemobject to create a new text file
somewhere with the contents of the output if that's your ultimate goal.
Steve Yandl
'------------------------------------
Sub FetchIPconfig()
Dim r As Integer
r = 1
Set objShell = CreateObject("Wscript.Shell")
Set objWshExec = objShell.Exec("ipconfig")
Set objStdOut = objWshExec.StdOut
Do Until objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
Cells(r, 1).Value = strLine
r = r + 1
Loop
Columns("A:A").EntireColumn.AutoFit
Set objStdOut = Nothing
Set objWshExec = Nothing
Set objShell = Nothing
End Sub
'-------------------------------------
"TomD" wrote in message
...
I have a program that prints to the screen. From a DOS window, or with a
BAT
file I can redirect the data to a file via the following command "Path
Arg1
Arg2 Filename. But, when I execute the BAT file from a VB program, using
either Shell or FollowHyperlink, the output file is created or recreated
but
remains empty. Any help will be greatly appreciated.
TomD