How to export a host screen to Microsoft Word

How to export a host screen to Microsoft Word

A macro can be used to "scrape" the data from the current Flex Terminal Emulator host screen and export to a Word document.  The sample macro code below demonstrates this:

Sample Code:


Sub Main()

' Create the Word objects
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
Set objRng = objDoc.Bookmarks("\endofdoc").Range
objWord.Visible = true
Call Word_log (objLine, objRng)
End Sub

' Subroutine to export the host screen data
Sub Word_log (objLine, objRng)
  nRow = FlexScreen.Rows
  nCol = FlexScreen.Columns
  For i = 1 to nRow
    objLine = FlexScreen.GetText(FlexScreen.Position(i, 1), nCol)
    objRng.InsertAfter objLine
    objRng.InsertAfter vbCRLF
  Next
End Sub

Notes:

  • In the example above, the screen size is determined by the variables nRow and nCol and will export the entire host screen, regardless of the size.

  • You may copy the above sample code, paste into Notepad or another text editor, then save to the Macros subfolder of the Flex Terminal Emulator user directory with the .ams file extension to utilize in your environment.
    • Related Articles

    • How to export a host screen to a new Outlook email message

      A macro can be used to "scrape" the data from the current Flex Terminal Emulator host screen and export to a newly created Outlook email message. The sample macro code below demonstrates this: Sample Code: Sub Main() Dim outobj, mailobj ' Determine ...
    • How to export data from several host screens to cells in an Excel spreadsheet

      A macro can be used to "scrape" specific table data from the current Flex Terminal Emulator host screen, export to cells within a newly created Excel spreadsheet, then repeat this process to traverse multiple host screens. The sample macro code below ...
    • How to override translations for particular host characters

      There are certain characters that do not translate correctly on my host. Is there some way to override translations to get the desired result? As of Flex Terminal Emulator version 4.0.4024.1512, overriding of character translations is now possible. ...
    • What host code pages are available in Flex Terminal Emulator

      The following host code pages are supported in Flex Terminal Emulator: 037 US / Canada 273 Austria / Germany 277 Denmark / Norway 278 Finland / Sweden 280 Italy 284 Spain / Latin America 285 United Kingdom 297 France 500 International 1140 US / ...
    • How to apply or update the Flex Terminal Emulator license code

      The license code can be applied or updated thru the Flex Terminal Emulator Workspace or via the FlexLicense.exe application located in the Flex Terminal Emulator installation directory. Updating thru the Flex Terminal Emulator Workspace: Open the ...