<< Click to Display Table of Contents >>
ExecuteExternalApp |
ExecuteExternalApp(AppPath, Arguments, InitialDir, CmdShow, [ProcessId])
This method executes an external application with name and path indicated by the AppPath parameter, with arguments indicated by the Arguments parameter, and starting at the working directory indicated by the InitialDir parameter. When a document is specified in the AppPath parameter, the application associated to this document is executed and this document is passed as one of the parameters of that application. The ProcessID parameter receives a number that identifies the external application process on the operating system. This number is used in the IsAppRunning method and is the same value that appears on Windows Task Manager, on PID column. The CmdShow parameter specifies the opening mode of this application's window, as described on the next table.
Available options for the CmdShow parameter
Option |
Description |
---|---|
0 |
Hides this window and activates another window |
1 |
Activates and displays this window. If this window is maximized or minimized, it is restored to its original size and position. An application must specify this value when it is displaying a window for the first time |
2 |
Activates this window and displays it minimized |
3 |
Activates this window and displays it maximized |
4 |
Displays this window with its most recent size and position. The active window remains active |
5 |
Activates this window and display it with its current size and position |
6 |
Minimizes this window and activates the next higher level window |
7 |
Displays this window minimized. The active window remains active |
8 |
Displays this window in its current state. The active window remains active |
9 |
Activates and displays this window. If this window is maximized or minimized, it is restored to its original size and position. An application must specify this value when restoring a window that was minimized |
Example:
Sub CommandButton1_Click()
Dim ret
Application.ExecuteExternalApp "calc.exe", "", "", 1, ret
Application.GetObject("Data.InternalTag1").Value = ret
End Sub
NOTE |
The parameter returned by ProcessID can be 0 (zero), in case no process is started. For example, if an open document is a URL and an Internet Explorer's instance is already executing, it displays that document. No new process is started, thus ProcessID is 0 (zero). |