Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default tried to execute application from VBA

Seems to me that the command isn't actually being executed by the Shell
function.

To ensure the command you expect is being executed by Shell I would
breakpoint the line:

MyRun = Shell(f & "\test_dll.exe", 1)

Then in the debug window:

? f & "\test_dll.exe"

Now open up a command prompt by typing run then CMD and type in the result
EXACTLY as this is what Shell will do.

I say use a command prompt as if it's a compiled fortran program without a
UI you will be able to see what's going on without the window just flashing
on screen.

If this works you at least have a starting point for further investigation.



http://www.billlunney.com/Excel/FAQ/...?ExcelFAQID=41


--

Regards,


Bill Lunney
www.billlunney.com

"Domagoj Vulin" wrote in message
...
I have Excel sheets and small Fortran application. I made a VBA macro that
saves input data for Fortran exe into a .txt file.
After that, I used Shell function in VBA macro tu execute FOR application
and there is no error message, but there's neither a output TXT file that
this FOR application usually creates.
I looked in the folder where are all the files (Workbook, input TXT that
macro created, Fortran EXE) and there is no output TXT file. Then, if I
started that Fortran.exe from windows it creates the output file from that
input file that I already created using the mentioned macro.
I tried to find more about Shell function, but there is only a simple
example that starts calc.exe from VBA macro.

However, here is the critical part of code:
...
Set filFile = fso.OpenTextFile(f & "\input.txt", 2, 1)
filFile.WriteLine MP
filFile.Close
Set filFile = Nothing
Set fso = Nothing
MyRun = Shell(f & "\test_dll.exe", 1)

Maybe the Shell function starts before the input.txt file is actually
closed, i don't know...

Thanks in advance








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button to execute Add-in Aerojade Excel Discussion (Misc queries) 3 October 3rd 08 09:46 PM
Five plus mintues to execute CB Excel Discussion (Misc queries) 5 August 25th 08 09:48 PM
Execute a sub in a different project Antonio Excel Discussion (Misc queries) 8 June 10th 06 12:48 AM
Could not execute Gary Excel Worksheet Functions 1 December 20th 04 06:20 PM
tried to execute application from VBA Tom Ogilvy Excel Programming 1 July 23rd 03 09:56 PM


All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"