PASSPORT Knowledge Base
Macros

Date Published: April 9, 2009

Title

Running a PASSPORT macro using a Visual Basic Application

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

I am converting from Extra to PASSPORT.  I need to run a PASSPORT Macro from a Visual Basic Application. We can do this with Extra by running a command that names an Extra EXE (ebrun.exe) and the name of the macro.  How can this be done with PASSPORT?

Solution

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

More Information

Keywords

visual basic, vb, vba, application, macro, convert, converting, Extra, command