How can I create two session objects?
I'm having trouble creating two seperate sessions of WRQ Reflection for HP. My code for creating the first session works fine, but when I try to create the second session. I get errors like, Connection Type can't be changed.
Code:
Private Sub OpenSessionF1()
Dim isFound As Integer
Dim MyObjectF1 As Reflection1.Session
Set MyObjectF1 = CreateObject("Reflection1.Session")
MyObjectF1.Visible = True
With Session '<------------------------------------ I think my problem is here.
.ConnectionType = "BEST-NETWORK"
.ConnectionSettings = "Host 192.6.22.2"
.Connect
isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
If isFound = False Then .Disconnect
End With
End Sub
Private Sub OpenSessionF2()
Dim isFound As Integer
Dim MyObjectF2 As Reflection1.Session
Set MyObjectF2 = CreateObject("Reflection1.Session")
MyObjectF2.Visible = True
With Session '<---------------------------------------Same Name so Same Session ??
.ConnectionType = "BEST-NETWORK"
.ConnectionSettings = "Host 192.6.22.2"
.Connect
isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
If isFound = False Then .Disconnect
End With
End Sub
How do I assign a variable to the Session?
Re: How can I create two session objects?
HAVE YOU TRIED CREATING A "NEW" OBJECT
Code:
Private Sub OpenSessionF1()
Dim isFound As Integer
Dim MyObjectF1 As NEW Reflection1.Session <=======================
Set MyObjectF1 = CreateObject("Reflection1.Session")
MyObjectF1.Visible = True
With Session '<------------------------------------ I think my problem is here.
.ConnectionType = "BEST-NETWORK"
.ConnectionSettings = "Host 192.6.22.2"
.Connect
isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
If isFound = False Then .Disconnect
End With
End Sub
Private Sub OpenSessionF2()
Dim isFound As Integer
Dim MyObjectF2 As NEW Reflection1.Session <=====================
Set MyObjectF2 = CreateObject("Reflection1.Session")
MyObjectF2.Visible = True
With Session '<---------------------------------------Same Name so Same Session ??
.ConnectionType = "BEST-NETWORK"
.ConnectionSettings = "Host 192.6.22.2"
.Connect
isFound = .WaitForString("MPE/iX", 0, rcAllowKeystrokes)
If isFound = False Then .Disconnect
End With
End Sub