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 FlexTerm 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 FlexTerm user directory 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 FlexTerm 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 the actual ...
    • 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 FlexTerm 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 demonstrates ...
    • What host code pages are available in FlexTerm

      The following host code pages are supported in FlexTerm: 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 / Canada Euro 1141 ...
    • 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 FlexTerm version 4.0.4024.1512, overriding of character translations is now possible. Once upgraded ...
    • How to maximize the FlexTerm host screen area

      Users may wish to hide or disable some of the advanced features of FlexTerm in order to acquire additional space for the FlexTerm host screen area.  Below are some tips to help accomplish this: Status Bar By default, the Status Bar is displayed at ...