InfoConnect VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmTerminal Object / AddVBAReference Method
The fully qualified file name of the session document file that contains the macros you want to share. Network locations should be specified with UNC file paths.
Example
In This Topic
    AddVBAReference Method (IbmTerminal)
    In This Topic
    Adds a reference to a session file that contains macros you want to share with the current session to the VBA References settings. After you add the reference, the macros in that file are available to the current session. When you save your session, the macros are saved in your current session document file and updated each time you reopen your session.
    Syntax
    expression.AddVBAReference( _
       ByVal sessionPath As String _
    ) 
    where expression is a variable that represents a IbmTerminal Object

    Parameters

    sessionPath
    The fully qualified file name of the session document file that contains the macros you want to share. Network locations should be specified with UNC file paths.
    Remarks

    Before you add a reference to a session document file, make sure that the file is in a trusted location that is specified with a UNC file path (if using a network location). Session document files cannot be accessed unless they are in trusted locations.

    Make sure the projects in the files you reference have unique project names. Each project name in the VBA editor must be unique to avoid errors caused by naming conflicts.

    Example
    This sample adds a reference to a session document file that contains macros and prints a list of all the referenced session documents. Then it removes the reference to the file and prints the list again.
    Sub AddAndRemoveVBAReference()
        
        Dim listOfSessionFiles() As String
        
        ThisIbmTerminal.AddVBAReference ("\\myServer\shared\sharedDemo.rd3x")
         
        listOfSessionFiles = ThisIbmTerminal.GetVBAReferences()
        Debug.Print "After adding to list"
        For Each Item In listOfSessionFiles
            Debug.Print Item
        Next
        
        ThisIbmTerminal.RemoveVBAReference ("\\myServer\shared\sharedDemo.rd3x")
        
        listOfSessionFiles = ThisIbmTerminal.GetVBAReferences()
        Debug.Print "After removing from list"
        For Each Item In listOfSessionFiles
            Debug.Print Item
        Next
        
    End Sub
    See Also