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

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 the actual screen size (number of rows and columns)

  nRow = FlexScreen.Rows
  nCol = FlexScreen.Columns    

  Set outobj = CreateObject("Outlook.Application")   
  Set mailobj = outobj.CreateItem(olMailItem)    

  For i = 1 to nRow
    strText = strText & FlexScreen.GetText(FlexScreen.Position(i, 1), nCol)
    strText = strText & vbCRLF
  Next

With mailobj
  .Subject = "Flex Terminal Emulator Screen"
  .Body = strText
  .Display
End With 

  'Clear the memory
  Set outobj = Nothing   
  Set mailobj = Nothing   

End Sub

Notes:
  • The email created by the above sample uses the default font that Outlook is configured to use, which may cause alignment issues.  If so, after the host screen has been exported to the body of the email, select all the text (Alt-A) and change the font to one that is fixed pitch, for example Courier New or Consolas.

  • 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 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 = ...
    • 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 record a login macro and automatically run at startup

      Running a simple script that logs into the host is a common request, which is easily accomplished following the steps below: Record a Macro: Open the Flex Terminal Emulator workspace, which contains the session that you want to automatically login ...