Run Fortran exe from Excel.
Run Fortran exe from Excel.
(OP)
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...
Thanks in advance
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...
Thanks in advance





RE: Run Fortran exe from Excel.
I've done similar things using Excel to transfer input data to Word, Word for editing the input file, running a Fortran program, opening the output file in Word and transferring the data into Excel
TTFN
RE: Run Fortran exe from Excel.
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Run Fortran exe from Excel.
TTFN
RE: Run Fortran exe from Excel.