Example

This example uses the Connected property to check for a connection before configuring a Telnet session. Session setup commands such as SetupSession and Hostname return an error if you attempt to configure them while you are connected.

Sub ConfigureTelnetSessionAndConnect()

 With Session

  If .Connected = False Then

   'Configure a 3270 session using Telnet

   .SetupSession rc3270Terminal, rc3270MODEL2E, rcTelnet

   'Specify the host IP address

   .Hostname = "123.456.78.9"

   'Connect to the host

   .Connect

  Else

   MsgBox "You are already connected to a host."

  End If

 End With

End Sub