Sub GetControls()
Dim sessionPath As String
Dim controls() As Variant
'Declare an object variable for the Application Object
Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
'Get a handle to the Application object
Set app = GetObject("InfoConnect Workspace")
'Get the control with this file path
'Edit the next statement to contain the name of your session
sessionPath = Environ("USERPROFILE") & "\Documents\Micro Focus\InfoConnect\Accounts.rd3x"
controls = app.GetControlsByFilePath(sessionPath)
'Check to make sure the session is running
If UBound(controls) = -1 Then
Exit Sub
Else
'Toggle the connection state for the control
If controls(0).IsConnected Then
controls(0).Disconnect
Else
controls(0).Connect
End If
End If
End Sub