You can use Reflection 2011 to control an application that supports Automation (such as Word or Excel).
The following procedure shows how to copy text from the Reflection 2011 screen display and enter that text into a Word document.
Note: This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept.It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Attachmate provides this sample code "AS IS" with no warranties. In this example, the command for OpenSystems hosts (UNIX, OpenVMS, and ReGIS Graphics) is commented out.
Sub SendTextToWord()
Dim displayText As String
'For IBM hosts:
With ThisIBMScreen
displayText = .GetText(18, 2, 50)
'For OpenSystems hosts:
'With ThisScreen
'displayText = .GetText2(.ScreenTopRow,0,_
'.ScreenTopRow+.DisplayRows,.DisplayColumns)
End With
Set Word = CreateObject("Word.Application")
Word.Visible = True
Word.Documents.Add
Word.Selection.TypeText Text:=displayText
'Type a path to which you have read/write access.
Word.ActiveDocument.SaveAs
Filename:=_"C:\Users\[UserName]\Documents\MySample.doc"
Word.Quit
End Sub