Print text-file on printer


Sub PrintTextFile (ByVal TextFile$, ByVal intTabWidth%)

Static I%
Static CurrentWord$

'Set the font here

ArrayPointer = 1
Cols(1) = 2000
DefineColumns 2
Printer.FontName = gudtPrintOptions.PrintingFont
PrintPageNumber
For I = 1 To Len(TextFile)
    CurrentWord = ""
    If Mid$(TextFile, I, 2) = Chr$(13) & Chr$(10) Then
    'Program prints its own carriage returns
        CarriageReturn
        I = I + 2
    End If
    If Printer.CurrentX < gudtPrintOptions.LeftMargin Then Printer.CurrentX = gudtPrintOptions.LeftMargin
    'If Printer.CurrentX + Len(PrintString) > gudtPrintOptions.RightMargin Then Printer.Print
    If Mid$(TextFile, I, 1) = chr(9) Then
        Printer.Print Spc(intTabWidth);
    Else
        Printer.Print Mid$(TextFile, I, 1);
    End If
Next I
Printer.EndDoc

End Sub



Mail to Daniel Wiman <daniel@wimania.com>
Online since June 1996, updated 980315
<- The VB home
<- Daniels homepage