'Written: May 12, 2010
'Author: Leith Ross
'Summary: Run any registered program or open a web site using the Windows API
Private Declare Function ShellExecute _
Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
Sub RunTest()
Dim FilePath As String
Dim RetVal As Long
' Change the path to the file you want to open
FilePath = "C:\Extra Attachmate.exe"
RetVal = ShellExecute(0&, "open", FilePath, "", "", 1)
End Sub
Sub ConnectToAttachmateStuff()
Dim oSys As Object
Dim oSess As Object
Dim oScreen As Object
Dim attSys As ExtraSystem
Dim attSess As ExtraSession
Dim attScreen As ExtraScreen
Set oSys = CreateObject("Extra.System")
If oSys Is Nothing Then
MsgBox ("Could not create Extra.System...is E!PC installed on this machine?")
Exit Sub
End If
'GET ACCESS TO THE CURRENTLY ACTIVE SESSION...
Set oSess = sys.ActiveSession
If oSess Is Nothing Then
MsgBox ("No session available...stopping macro playback.")
Exit Sub
End If
Set oScreen = oSess.screen
'display the first 40 characters on line 1 after character 19 in a message box
MsgBox (oScreen.getstring(1, 20, 40))
End Sub