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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems runnig exe from VBA

Status
Not open for further replies.

xxxmudpie

Technical User
Dec 18, 2006
1
CA
I'm trying to run a compiled Fortran code from excel. The DOS window shows up briefly, but nothing happens - it should create a few output files. I checked using explorer and it as accessed the file at that time.
Obviously, I've clicked on the .exe and it works fine on its own.
So I made a .bat file that runs the .exe. and called that from excel, just to see...same thing. However if I double click on the .bat file on its own no problem.
Any clues? It seems like Excel isn't allowing the program time to finish and cutting off early?
Here's what I use to execute files in excel:
"ReturnValue = Shell(ThisWorkbook.Path & "\testy.bat", 1)"

any help very gratefully received
thanks
 
You may try this:
CreateObject("WScript.Shell").Run Chr(34) & ThisWorkbook.Path & "\testy.bat" & Chr(34), 1, True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top