Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
Dim rcode As ReturnCode
Dim pw As String
'Prompt for a password
pw = ThisIbmTerminal.Macro.PasswordBox("enter your password", "password")
'Move the cursor to the user name field and put the user id in that field
rcode = ThisIbmScreen.MoveCursorTo1(20, 16)
rcode = ThisIbmScreen.PutText2("userid", 20, 16)
'Put the password in the password field
rcode = ThisIbmScreen.PutText2(pw, 21, 16)
'Enter the user ID and password
ThisIbmScreen.SendControlKey ControlKeyCode_Transmit
End Sub