Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How To Run Fortran.exe using Excel

  1. Feb 20, 2012 #1
    Hello everybody,

    I have a fortran.exe (compiled using intel visual fortan comipler 10.1.24 and VS 2005) which takes an input.dat file and generates output.dat.

    Currently, I am trying to control fortran.exe execution with excel 2010 shell function. But it is not working properly.

    The Shell function syntax is correct, it does run fortran.exe and DOS window can be seen. But fortran.exe ends prematurely without generating output.dat file. However, In case of double-clicking fortran.exe, it runs and reads input.dat and generate output.dat properly.

    I have spent several days on this problem. I have recompile program, relaxed excel-marco security setting etc, but in vain.There are similar posts on web describing such problem, but no one clearly described the solution.

    Surprisingly, using same shell function i can successfully run a java.exe file.

    Any kind of comments, suggestion, advice regarding above problem will be warmly welcomed.
  2. jcsd
  3. Feb 20, 2012 #2
    Disclaimer: don't use excel much, don't know VBA, don't do much DOS.

    Debugging/testing ideas:
    are all the files in the same directory? including the fortran exe?
    is the command to start the fortran exe instructed to wait for it to finish?
    google returned a few hints about calling fortran DLLs from excel, is this of no use to you?
  4. Feb 20, 2012 #3
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook