|Running external applications|
|By: Lorenzo Dalla Vecchia Date: 16/04/2000|
This question has been asked me countless times: how
can I run an external application from within my VB program?
I have finally decided to post a tip that describes that very simple task.
The key is the Shell function included with VB. The simplier use of it is the following:
Just replace app-path with a valid path to an EXE file (i.e.
There is also a slightly different syntax for Shell:
|Dim ProgID As Long
ProgID = Shell "app-path"
In this case, the ProgID variable will be filled with a unique identifier for the application: that number can be used in other VB commands, such as AppActivate and SendKeys to refer to the application.
Remember that the app-path string can also include parameters for the EXE file, so you can open documents. The following code opens a document with Notepad:
|Shell "C:\Windows\Notepad.Exe C:\Myfile.Txt"|
|Visual Basic Programming Zone is a website by
Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it