Starting a "command line" .exe program from within an excel spreadsheet

  • Thread starter Thread starter kilter
  • Start date Start date
K

kilter

Is there a way to link an external .exe file to a button on a
worksheet. I have a fortran program, which carries out a set of
analyses, that I would like to be able to call from a worksheet.

Many thanks

Richard
 
Richard,

Attach a macro to the button, along the lines of

Sub RunDOSProgram()
Dim myProgram As String
myProgram = "C:\Program Files\BlahBlah.EXE -s"
TaskID = Shell(myProgram, 1)
End Sub

I don't have any old DOS execeutables to test, so.....

HTH,
Bernie
MS Excel MVP
 
Bernie Deitrick said:
Richard,

Attach a macro to the button, along the lines of

Sub RunDOSProgram()
Dim myProgram As String
myProgram = "C:\Program Files\BlahBlah.EXE -s"
TaskID = Shell(myProgram, 1)
End Sub

This runs the program in parallel with Excel, i.e., synchronously. If
the OP wants the outside program to complete before the Excel macro
continues, better to use the macro found in the following linked
article in the archives.

http://groups.google.com/group/microsoft.public.excel.misc/msg/9a750a70b8ec3190
I don't have any old DOS execeutables to test, so.....
....

Really?! Not even COMMAND.COM, DEBUG.COM or EDLIN.COM, all of which
are 16-bit programs still installed by default up through Windows XP.
Dunno about Windows Vista, but any .COM file is a 16-bit program, and
I suspect there are still a few lurking in Vista.
 
Back
Top