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

Opening other Applications From Excel

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
I am Trying to Open an application called Lex.exe in Excel using VBA. I was sucessfull in opening the file using the following command:

rsp = Shell("C:\Temp Data Files\Raw Data\9005lex.exe")

however in order to the application (lex.exe) to execute after opening I have to type a 'Y', this I cannot get to work.

Any assistance will be greatly appreciated.
 
Try putting (after the shell command)

sendkeys "Y"

You may have to play with timing to get it just right.

Rob
[flowerface]
 
I tried using the Snedkey "Y"
and it never seems to send the Key.
I even had it send the key 4 difernet times in the same script???
 
Does your .exe become the active window after the shell command? How long does it take to load up? You may need to put in a pause. For example, if it takes two seconds to load up, try:

shell...
application.Wait now()+2/24/3600
sendkeys "Y"

Rob
[flowerface]
 
Rob,

Yes the 9005lex.exe becomes the Active window after the shell command.
 
I guess it must not be a well-behaved executable. The approach above, using sendkeys, normally works. For example, I used it quite successfully for the calculator program in accessories (calc.exe).
Rob
[flowerface]
 
If your still having problems one solution may be to use the program key text
it is a trial version and it says its for 30 days but it keeps going. It is basically like a macro for the whole of windows so it if you open it in your excel macro and run it then close it again it should deal with your y problem.
Giv it a try
Andrew299
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top