I use VBA to work with a TN3270 emulation session. I would like to look at a field on a screen and determine if it is protected or not. If it's not protected, I will write data to that field. I have managed to make it work through the macro software provided with the emulation software; however, I can not seem to get to work with VBA. Below is how I connect to the 3270 session.
Dim Session As New atmsession
Dim Screen As New atmscreen3270
Dim Connection As Object
Dim Model As ATM_3270_MODEL
Set Session = New atmsession
Set Screen = New atmscreen3270
Session.Screen = Screen
Forms![Systems Applications].AtmTerminal1
.Session = Session
Set Connection = CreateObject("atm.con.tn32
70")
Connection.UseTN3270E = True
Session.Screen.Model = ATM_3270_MODEL_5
Connection.RemoteHostAddre
ss = "XXX.XXX.XXX.XXX"
Connection.DestinationPort
= XXXX
Connection.ResourceName = "#XXXXCCC"
Connection.TimeOut = 15
Forms![Systems Applications].AtmTerminal1
.Session.C
onnection = Connection
Forms![Systems Applications].AtmTerminal1
.Session.C
onnect 0
'This is the code that worked in the macro editor with the emulation software:
attr1 = session.screen.feldattribu
te(7, 7)
if attr1 = 240 or attr1 = 249 then
msgbox ("Field is protected")
else
session.screen.putstring "XXXX",7,7
session.screen.waithostqui
et 1000, -1
end if
Start Free Trial