Reflection Desktop VBA Guide
In This Topic
    Get Object
    In This Topic

    In , GetObject calls can only support one type of legacy object, based on your Legacy API preference. For example, if you want GetObject to return the EXTRA! session object instead of the legacy session object, you will need to specify EXTRA! as the preferred API type in the Legacy API preference. For more information, see the Help.

    In this example, GetObject attaches to a running instance of by using the Automation server name (the default AutomationServerName value " Workspace"). This technique allows you to identify a particular instance even if multiple instances are active.

    Dim ApplicationObject As Attachmate__Objects_Framework.ApplicationObject
    Set ApplicationObject = GetObject(" Workspace")
    ApplicationObject.CreateControl("C:\Users\[Username]\Documents\Micro Focus\\MySession.rd5x")
    

    In this second example, GetObject attaches to a running instance of . The comma after GetObject indicates that the first argument has been omitted. The line continuation character, an underscore preceded by a space, is used to break up the long line of code.

    Dim App As Attachmate__Objects_Framework.ApplicationObject
    Set App = GetObject(, _ "Attachmate__Objects_Framework.ApplicationObject")
    

    In this last example, GetObject opens a new instance of by returning a reference to the ApplicationObject object. The first argument includes an empty string. The line continuation character, an underscore preceded by a space, is used to break up the long line of code.

    Dim App As Attachmate__Objects_Framework.ApplicationObject
    Set App = GetObject("", _ "Attachmate__Objects_Framework.ApplicationObject")