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

Open with .exe application file

Status
Not open for further replies.

deltaair

IS-IT--Management
Nov 3, 2005
43
CH
1.) In Excel VB Editor, is there a way to code a subroutine, to open an external .exe file.

2.) If the above is possible, the external .exe file is an internal company program with a text prompt like DOS (or UNIX), IS THERE A Way I can have the computer run a key combination like CTRL+X or something in that application? or simply have the computer type in something into that prompt? Remember: I need to code this in Excel VB Editor, because that's all I have.

3.) If (1) IS possible but (2) is NOT possible, can i open an external file WITH this external application. Like in windows we can select "Open With" by right clicking. ?

Thank you
 
Remember: I need to code this in Excel VB Editor, because that's all I have.

Why can't you use a Batch script (.bat)? It sounds like that would be more appropriate.

_________________
Bob Rashkin
 
Unless there is a specific need to use Excel VBA, a batch file does seem appropriate.

However, take a look at Shell in Help. Yes you can execute an .exe using Excel VBA. So #1 is Yes.

Regarding #2, and #3 - it depends on that application. If the .exe accepts parameters...then it accepts parameters (like a file name); it it does not accept parameters...then it doesn't.

This can be answered by testing. Open a commandline and run the .exe with parameters. It it runs with them...then you can use the same ones with Shell.

Gerry
 
How do I use a batch script.

Where can I read more reference material on "Shell"... how do I use it, what is it.

Thank you for your help.
 
In Windows (or, DOS, really), a batch script is one of 3 types of files that run in the OS (.exe, .cmd, and .bat). The syntax is similar to any shell scripting and your Windows Help has some guidance on that. To execute a batch script, you can double-click the .bat file or invoke it (> <filename>.bat {enter}) from the DOS prompt.

_________________
Bob Rashkin
 
How can i convert my VB Excel code to a Batch Script ?
 
OK. Maybe there is a reason you want to use a VBA macro. Besides trying to open (run) an external file, what is your macro doing?

_________________
Bob Rashkin
 
This external application is say myApp.exe. This application itself has self-contained macros, which exist in the form of unicode text files. These text files have to be updated for certain dates. My macros read in these text files and update the dates for more current ones, so that these macros can be used by our computer on that myApp.exe. The MAcros for the external app are encoded to be activated as CTRL+X, CTRL+Y etc. I need the macro or .bat script or something to open this external app and the macros that go with it.
 
Does "myApp.exe" accept command line arguments? That is, from a DOS prompt can you invoke it with the parameters to make it do what you want? If not, you may want to operate directly on the text files and not go through "myApp".

_________________
Bob Rashkin
 
Which is what I asked.... Open a commandline and TRY running the application with your parameters.

You want more information on Shell? Did you look in Help?

I think you need to walk through things, step-by-step.

What are you doing NOW? How is this app being executed NOW?

The Ctrl-Y business sounds like keyboard shortcuts to me.
This application itself has self-contained macros, which exist in the form of unicode text files. These text files have to be updated for certain dates. My macros read in these text files and update the dates for more current ones, so that these macros can be used by our computer on that myApp.exe.
There are logical inconsistencies in the above.

The application has self-contained macros...that exist outside the application apparently, in text files.

"My macros read in these files" - the macros read in themselves??? so they can be used my that application.

Reading that seems to say - the application reads macro files that read themselves so the application can read the macro files.

Hmmmmm. On the face of it, that application does not seem to know what it is doing.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top