To all concerned:
IainTheVBALearner has requested that their points be returned and this question stored in our database for its potential value to others. It appears as though no one is disputing that request, so it has been granted. I have reduced the points from 300 to zero.
Thank you.
turn123
Page Editor
Main Topics
Browse All Topics





by: IainTheVBALearnerPosted on 2004-03-23 at 11:34:33ID: 10660817
Emm....here is a solution to this - it is a macro I found on my pc in work which came with the Attachmate Extra! software.
********** ***
")
********** *
It's a bit full of nonsense, and it can be simplified a lot.
With my situation, this did not print the last final 2 characters of each row, 78 only instead of 80 so I had to create an instance of Word, dump the block of text to it, format it and print it, then close Word - took a bit of messing about but I got there in the end.
**************************
Option Explicit
Sub Main
' Dimension macro variables and objects
Dim rc%, row%, MaxColumns%, MaxRows%, filenum%
Dim Screenbuf$, linebuf$, FileName$
Dim System As Object
Dim Session as Object
' Get the main system 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
' Get the necessary Session Object
Set Session = System.ActiveSession
If (Session is Nothing) Then
Msgbox "Could not create the Session object. Aborting macro
playback."
Stop
End If
' Determine the size of the Presentation Space
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()
' Initialize variables to hold screen information
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)
' Copy the Presentation space
For row% = 1 to MaxRows%
' Get a row of data from the host screen
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, ,
xBlock)
' Store the line read into screenbuf$
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next
' Get the next available file number
filenum% = FreeFile
' Open the printer. To print to a file, set FileName$ to a file name.
' In this example, "\\TES\L4S_HP" is a network printer name.
' Change this to your printer name.
FileName$ = "\\TES\L4S_HP"
Open FileName$ For Output as filenum%
' Print the screen with a form feed
Print # filenum%, screenbuf$; Chr$ (12)
'Close printer
Close filenum%
End Sub
**************************
Iain