Exporting a Host Screen to an Outlook Email
Flex Terminal Emulator allows you to export the contents of a host screen directly into a new Microsoft Outlook email using a macro. This is useful for quickly sharing or documenting screen data.
Overview
The macro performs the following actions:
Captures all visible text from the current host screen
Creates a new Outlook email message
Inserts the captured screen content into the email body
Displays the email for review before sending
Sample Macro Code
The example below demonstrates how to export the current screen to an Outlook email:
- Sub Main()
- Dim outobj, mailobj
- ' Determine the screen size
- nRow = FlexScreen.Rows
- nCol = FlexScreen.Columns
- ' Create Outlook objects
- Set outobj = CreateObject("Outlook.Application")
- Set mailobj = outobj.CreateItem(olMailItem)
- ' Capture screen text line by line
- For i = 1 to nRow
- strText = strText & FlexScreen.GetText(FlexScreen.Position(i, 1), nCol)
- strText = strText & vbCRLF
- Next
- ' Populate the email
- With mailobj
- .Subject = "Flex Terminal Emulator Screen"
- .Body = strText
- .Display
- End With
- ' Clean up
- Set outobj = Nothing
- Set mailobj = Nothing
- End Sub
How It Works
The macro retrieves the number of rows and columns from the current host screen.
It loops through each row, capturing the full width of text.
The captured content is assembled into a single string with line breaks.
A new Outlook email is created and populated with the screen data.
The email is displayed so you can review, edit, and send it.
Notes
The email body uses the default font configured in Outlook.
If the screen formatting appears misaligned, change the font to a fixed-width (monospaced) font such as:
You can do this by selecting all text in the email (press Ctrl+A) and choosing a different font.
Saving and Using the Macro
To use this macro:
Copy the code into the Flex Terminal Emulator macro editor, or any text editor (such as Notepad).
Save the file with an .ams extension.
Place the file in the Macros subfolder of your Flex Terminal Emulator user directory.
Run the macro from within Flex Terminal Emulator.
This method provides a quick and efficient way to capture and share host screen data via email.
Related Articles
Exporting Host Screen Data to Excel Using a Macro
Flex Terminal Emulator allows you to automate the extraction of data from host screens and export it directly into an Excel spreadsheet using a macro. This approach is useful for collecting structured data across multiple screens. Overview A macro ...
Exporting a Host Screen to Microsoft Word
Flex Terminal Emulator allows you to export the contents of a host screen directly into a Microsoft Word document using a macro. This is useful for documentation, reporting, or sharing screen data. Overview The macro performs the following actions: ...
Supported Host Code Pages in Flex Terminal Emulator
Flex Terminal Emulator supports a range of host code pages to ensure compatibility with different regional and language requirements. Available Host Code Pages The following host code pages are supported: 037 – US / Canada 273 – Austria / Germany 277 ...
Recording a Login Macro and Running It Automatically at Startup
Flex Terminal Emulator allows you to automate the login process by recording a macro and configuring it to run each time a session connects to the host. Step 1: Record a Login Macro Follow these steps to capture your login sequence: Open the Flex ...
Maximizing the Host Screen Area in Flex Terminal Emulator
To increase the visible host screen area in Flex Terminal Emulator, you can hide or minimize certain interface elements. The following options can help you optimize screen space. Hide the Status Bar The Status Bar is displayed at the bottom of the ...