Launch External Executable Application by Macro


Posted by Santosh on May 24, 2001 12:53 PM

I am looking for a way to have an Excel Macro start a DOS based executable program. Once launched, I want the macro to input some information, such as user name and file name, into the external application, and once the external application has completed its task, the macro should close the external application.

I know Excel can open up a PowerPoint application so I was thinking it should be able to open a non-Microsoft application. Any help would be greatly appreciated.

Thanks,
Santosh

Posted by Dax on May 24, 2001 1:48 PM


Hi,

Unless the other application supports OLE automation (which is unlikely in this case) the easiest way to start the program is to do something like this:-


Sub StartYourApp()
x = Shell("C:\ProgramName.exe")
AppActivate x
SendKeys "FileName"
SendKeys "{ENTER}"
End Sub

This runs the other application, activates it and then sends various keystrokes to it.

HTH,
Dax.



Posted by Santosh on May 24, 2001 2:04 PM

Hi Dax,

The code you gave me works. It opens up the application I want but I did not have to use 'AppActivate x'. I commented it out and it works fine. ??? I still have a little more coding to do but I think I'm on the right path now. Thank you very much for you help.

Santosh