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

Open executable file in macro/hotspot

Status
Not open for further replies.

iluv2ski

IS-IT--Management
Nov 14, 2002
6
US
I am attempting to open an executable file within a macro. The application is not already open, so you cannot use the "appactivate" method. I was looking at the "shell" function, but cannot find a good example of code to look at, it is all bits and pieces.

Does anyone have some macro code that will open an executable file, plz include all of macro.

Thanks
 
Try the following Technical Bulleting from Attachamte for more information: (you may have to log in as a guest)

Or here is the example from macro help:

"The example uses Shell to leave the current application and run the Calculator program included with Microsoft Windows. It uses the two Windows calls to find and minimize the Program Manager and EXTRA! Basic. It then returns EXTRA! Basic back to normal after prompting the user.

Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer,
ByVal nCmdShow As Integer) As Integer
' The Declare statement above must appear on one line in your macro
' source code.
Declare Function FindWindow Lib "USER.EXE" (ByVal szClass$, ByVal
lpsz As Long) as Integer
' The Declare statement above must appear on one line in your macro
' source code.

Dim Hwnd as Integer

Sub Main

Hwnd% = FindWindow("progman",0) ' Find the Program Manager
x% = ShowWindow(Hwnd%,6) ' Minimize Program Manager

Hwnd% = FindWindow("EBFrameClass",0) ' Find EXTRA! Basic
x% = ShowWindow(Hwnd%,6) ' Minimize EXTRA! Basic

hWndCalc& = Shell("calc.exe", 1) ' Shell the calculator.

Msg$ = "Close the calculator and choose OK to return to EXTRA! Basic."
MsgBox Msg$

x% = ShowWindow(Hwnd%,1) ' Bring EXTRA! Basic back to
' normal size

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top