Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling fortran from vba

Status
Not open for further replies.

rafaeltini

Programmer
Nov 13, 2007
4
BR
i'm rtying to call a fortran exe from vba, but for some reason it doesn't start, but if i use it independent it works fine.
this is what i'm using to call.

Code:
retval = Shell("E:\Tini\Teste\sintese2.exe", 1)

the sintese2.exe should read an text file generated by excel, then, when the progran start it requires some user interaction on fortran.

any thoughts??
 
First of all, once your program is compiled, it should no longer matter to subsequent callers that it was FORTRAN, C, or whatever.

That said, from your post, it seems that you have some user interaction with "sintese2.exe". That implies a GUI and a window. Maybe you need AppActivate

vba help said:
AppActivate Statement


Activates an application window.

Syntax

AppActivate title[, wait]

The AppActivate statement syntax has these named arguments:

Part Description
title Required. String expression specifying the title in the title bar of the application window you want to activate. The task ID returned by the Shell function can be used in place of title to activate an application.
wait Optional. Boolean value specifying whether the calling application has the focus before activating another. If False (default), the specified application is immediately activated, even if the calling application does not have the focus. If True, the calling application waits until it has the focus, then activates the specified application.



Remarks

The AppActivate statement changes the focus to the named application or window but does not affect whether it is maximized or minimized. Focus moves from the activated application window when the user takes some action to change the focus or close the window. Use the Shell function to start an application and set the window style.

In determining which application to activate, title is compared to the title string of each running application. If there is no exact match, any application whose title string begins with title is activated. If there is more than one instance of the application named by title, one instance is arbitrarily activated.

_________________
Bob Rashkin
 
if i use it independent it works fine
How do you do that ? with a shortcut ?
Maybe you have to change the current drive and/or the current directory before launching this program ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i could do it in the end.. i changed from shell, to shellexecut.
not sure whats the diference yet.., im researching to understand the diference of the two comands
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top