Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello;
I would very much appreciate your expertise on how-to! In myBook1.xls, I've a VBA macro, say, Sub myMacro (), which generates, compiles, and saves a specially unformatted data file, say, myInputFile = "myInp123.inp", and assigns a name to be used later for an output file, say, myOutputFile = "myOut123.out" (for tracking purposes only). All files are in ThisWorkBook.Path. In the same folder, I've also the DOS program myProgram.exe. Here're the steps I currently follow successfully for a single run: 1. open myBook1.xls, run myMacro, and take note of the *.inp and *.out files names 2. quit Excel 3. open DOS window by clicking the Command Prompt shortcut 4. change DOS directory at the prompt to that of ThisWorkBook.Path, either by typing the Cd command several times, or by typing the name of the Batch file, say, myBatch.bat, which resides in the folder that the Command Prompt opens at (fixed location, say, C:\My Files). 5. type at the new DOS prompt the program name and the 2 re-directed files: .......... myProgram < myInp123.inp myOut123.out (return) 6. exit the DOS window, simply by typing Exit .....(The above steps 1 to 6 work fine with no problem) 7. intend to repeat steps 1 to 6 above, say, 100 times or so until an acceptable covergence is achieved (determind in Sub myMacro ()). .....(you may disregard steps 1, 2, 6, 7 above) Q: Can the above steps 3, 4 and 5 be coded in Sub myMacro () ?? ... or even better, in a separate macro in the same standard module, probably using the Public variable names myInput and myOutput ??? Your answer maybe: "It's very easy! Try this ...", or: "It's not possible .... forget it", or, preferably, something in-between !! Thank you kindly. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Running a macro from windows application | Excel Discussion (Misc queries) | |||
Running excel as an application | Excel Programming | |||
Running Macro from objApp Application object | Excel Programming | |||
Application Error when running Macro on Workbook open | Excel Programming | |||
Application Error when running Macro on Workbook open | Excel Programming |