Fortran How To Run Fortran.exe using Excel

  • Thread starter Thread starter khazarhayat
  • Start date Start date
  • Tags Tags
    Excel
AI Thread Summary
The discussion centers around issues with executing a Fortran program (fortran.exe) from Excel 2010 using the Shell function. Although the Shell function is correctly implemented and can launch fortran.exe, the program terminates prematurely without generating the expected output.dat file. In contrast, running fortran.exe directly by double-clicking it works as intended. The user has attempted various troubleshooting steps, including recompiling the program and adjusting Excel's macro security settings, but has not found a solution. The problem persists despite the successful execution of a Java program using the same Shell function. Suggestions from other users include verifying that all files are in the same directory, ensuring the command waits for the Fortran program to finish, and considering the possibility of using Fortran DLLs, although the user does not require data transfer between Excel and Fortran. Overall, the discussion seeks effective solutions to this execution issue.
khazarhayat
Messages
2
Reaction score
0
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.
 
Technology news on Phys.org
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?
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top