manipulating DOS
manipulating DOS
(OP)
Hello Every,
I wonder if this is possible at all. I have a program in DOS that i want to manipulate from Excel.
The DOS exe file use excel input files. Then i have to analyse the output from excel. Since i have to change interactively the input until i have satisfactory out i want to automate this. Use excel macro to input data in the dos program, then the macro analyse the output. If satisfactory then ok. If not input the results back in the DOS exe until satisfaction.
First is there anyway to start a dos program from Excel, then how to input files in the dos exe ?
Thanks alot !
I wonder if this is possible at all. I have a program in DOS that i want to manipulate from Excel.
The DOS exe file use excel input files. Then i have to analyse the output from excel. Since i have to change interactively the input until i have satisfactory out i want to automate this. Use excel macro to input data in the dos program, then the macro analyse the output. If satisfactory then ok. If not input the results back in the DOS exe until satisfaction.
First is there anyway to start a dos program from Excel, then how to input files in the dos exe ?
Thanks alot !





RE: manipulating DOS
In the excel workbook, create a hyperlink (right click the cell and link to the file) to your dos program, say in cell E32:
Then this macro will execute the program:
Sub Macro2()
Range("E32").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub
If you want the dos program to change based on some values in excel, then you could write the dos program in excel with the changing cells in the "correct" position of the DOS program. Then write a macro to save the excel file as a DOS program file, e.g.
Sub Macro8()
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\mgp\Desktop\Book1.cmd", FileFormat:=xlText, _
CreateBackup:=False
End Sub
Off course now you just saved the whole workbook as a .cmd file which wasn't the intent so maybe this should be in a seperate workbook, or otherwise you have to re-save the workbook to make it a .xls file again.
If the DOS output is a .txt file then you could always use a macro to "import external data". (see the "data" pulldown)
All of these macros are easily made by just using the macro recorder.
This might not solve all of your problems but at least it may give you something to experiment with.
regards
Mogens
RE: manipulating DOS
Thank you
RE: manipulating DOS
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.