Hey folks. I have the following code to print the screen in EXTRA:
This works fine to print the screen, however all formatting is lost in the process because the text is held in a string. Is there any to print the text without losing the formatting?
Code:
Sub Main
Dim rc%, row%, MaxColumns%, MaxRows%, filenum%
Dim Screenbuf$, linebuf$, FileName$
Dim System as Object
Dim Session as Object
dim Screen as Object
Set System = CreateObject("EXTRA.System")
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Aborting macro playback."
Stop
End If
Set Session = System.ActiveSession
If (Session is Nothing) Then
Msgbox "Could not create the Session object. Aborting macro playback."
Stop
End If
Set Screen = Session.Screen
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()
Screenbuf$ = ""
linebuf$ = Space$(MaxColumns%)
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next
filenum% = FreeFile
FileName$ = "\\myServer\myPrinter"
Open FileName$ For Output as filenum%
Print # filenum%, screenbuf$; Chr$ (12)
Close filenum%
End Sub