Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send control keys to Reflection from Excel using VBA

Status
Not open for further replies.

fgill

Programmer
May 23, 2012
1
US
Hello,
I am trying to send control keys to Reflection from Excel using VBA. I have successfully started a reflection session and have sent text to the screen.
What I have been unable to figure out is how to “press enter button”, or pass any control key.
Any assistance is greatly appreciated.

Using: Win7; Excel 2010; Attachmate Reflection Standard Suite 2011_15.3.436.0, Version R1 (15.3436.0)

The following is the VBA code from Excel:

Sub CreateReflectionObject()
'the following are the references which are selected
'Library Attachmate_Reflection_Objects
' C:\Program Files (x86)\Attachmate\Reflection\Attachmate.Reflection.Objects.tlb

'Library Attachmate_Reflection_Objects_Emulation_IbmHosts
' C:\Program Files (x86)\Attachmate\Reflection\Attachmate.Reflection.Objects.Emulation.IbmHosts.tlb

Const rcIBMEnterKey As Integer = 13

Set Ribm = CreateObject("ReflectionIBM.Session")
Ribm.Visible = True

With Ribm
.Hostname = "PRDPLEX-TN3270A.FGMFCON.COM"
.Connect
End With

With Ribm
.TransmitANSI "l cicsa1b2"

'none of the following examples work
.TransmitTerminalKey ([ENTER])
.TransmitTerminalKey rcIBMEnterKey
.TransmitTerminalKey (ControlKeyCode_Transmit)
.SendControlKey (rcIBMEnterKey)
.Transmit (ControlKeyCode_Transmit)

End With

End Sub
 

I don't use Reflection but I do use Extra.

You have assigned an APPLICATION object.

It seems that you should perhaps also assign a SESSION and SCREEN object or at least a SCREEN object to use any transmit or send method.

What does your Reflection HELP indicate as far as initializing your objects?

How does your help indicate that the transmit and send methods are to be referenced?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I use the ControlKeyCode_Transmit constant with the SendControlKey function, as in the following line:

screen.SendControlKey(ControlKeyCode_Transmit)


In this example, the screen variable is set to the Screen property of the Terminal object:

Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject
Dim screen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
Dim Terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
Dim Frame As Attachmate_Reflection_Objects.Frame
Dim View As Attachmate_Reflection_Objects.View

Set App = CreateObject("Attachmate_Reflection_Objects_Framework.ApplicationObject")

' Open a settings file from a trusted location
Set Terminal = App.CreateControl(sessionFilePath)
Set screen = Terminal.Screen
Set Frame = App.GetObject("Frame")
Frame.Visible = True
Set View = Frame.CreateView(Terminal)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top