Sub OpenSSHConnection()
Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject
Dim Terminal As Attachmate_Reflection_Objects_Emulation_OpenSystems.Terminal
Dim Frame As Attachmate_Reflection_Objects.Frame
On Error Resume Next
'Try to use the existing workspace
Set App = GetObject("Reflection Workspace")
On Error GoTo 0
'Otherwise, Create New instance of Reflection
If IsEmpty(App) Or (App Is Nothing) Then Set App = _
CreateObject("Attachmate_Reflection_Objects_Framework.ApplicationObject")
With App
Do While .IsInitialized = False
.Wait 200
Loop
'Obtain the Frame Handle
Set Frame = .GetObject("Frame")
'Make it visible to the user
Frame.Visible = True
End With
'Create an Open Systems control and immediately turn off autoconnect
Set Terminal = App.CreateControl2("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}")
With Terminal
.AutoConnect = False
'Set the connection type
.ConnectionType = ConnectionTypeOption_SecureShell
'Set your hostname and other connection settings
With .ConnectionSettingsSecureShell
.HostAddress = "hostName or IP Address"
.UserName = "admin"
End With
End With
'Create a view for the terminal
Set View = Frame.CreateView(Terminal)
'Manually call connect because Auto is now disabled
Terminal.Connect
End Sub