Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
tried to execute application from VBA
Thanks, it seems like it could work, i'll try it. As a newbie, I don't
undarstand that DoEvents thing... "Keith Willshaw" wrote in message ... "Domagoj Vulin" wrote in message ... I have Excel sheets and small Fortran application. I made a VBA macro that saves input data for Fortran exe into a .txt file. After that, I used Shell function in VBA macro tu execute FOR application and there is no error message, but there's neither a output TXT file that this FOR application usually creates. I looked in the folder where are all the files (Workbook, input TXT that macro created, Fortran EXE) and there is no output TXT file. Then, if I started that Fortran.exe from windows it creates the output file from that input file that I already created using the mentioned macro. I tried to find more about Shell function, but there is only a simple example that starts calc.exe from VBA macro. However, here is the critical part of code: ... Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1) filFile.WriteLine MP filFile.Close Set filFile = Nothing Set fso = Nothing MyRun = Shell(f & "\test_dll.exe", 1) Maybe the Shell function starts before the input.txt file is actually closed, i don't know... Try putting in a DoEvents function call between the file close and the shell function, that should force the OS to complete its housekeeping tasks Also check the value returned in MyRun, it should be the PID number of the fortran program The main thing I'd suggest is running the program from a batch file, this will allow you to put a PAUSE statement in the batch file and see whats happening ie. Create a batch file in the directory you want to use called myprog.bat The contents would be test_dll.exe PAUSE Then run this batch file with the shell function and it'll run in DOS prompt window that stays up Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Five plus mintues to execute | Excel Discussion (Misc queries) | |||
Execute C++ from Excel | New Users to Excel | |||
Could not execute | Excel Worksheet Functions | |||
tried to execute application from VBA | Excel Programming | |||
tried to execute application from VBA | Excel Programming |