Deep Patel: Running a PASSPORT Emulator macro using a Visual Basic Application(Excel Macro)

Wednesday, December 26, 2012

Running a PASSPORT Emulator macro using a Visual Basic Application(Excel Macro)


Title
Running a PASSPORT Emulator macro using a Visual Basic Application(Excel Macro)

Product
PASSPORT PC TO HOST

Emulation Types
SCO ANSI, Wyse 60, TN3270, TN5250, VT

Issue
Need to run a PASSPORT Macro from a Visual Basic Application.

Please see the following sample macro below:

Sub runmacro_zam()
    navigateto "C:\progra~1\passport\login.zam"
End Sub

Sub runmacro_zmc()
    navigateto "C:\progra~1\passport\login.zmc"
End Sub

Sub navigateto(macroname)
    Dim objSys
    Dim objSess
   
    Set objSys = CreateObject("PASSPORT.System")
    Set objSess = objSys.ActiveSession
   
    ' Assume you already have a PASSPORT session running
    objSess.navigateto macroname
End Sub

' You can use this too, but it will not work with a .zmc macro
Sub runmacro()
    Dim WshShell
   
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Exec ("C:\progra~1\passport\passatmr.exe /A 0 0 c:\progra~1\passport\login.zam")
End Sub

1 comment: