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?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top