CodeItBetter Programming Another VB Programming Blog

How to print a text file with its default printer

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'Text File Handling - How to print a text file with its default printer
Sub PrintFile(ByVal sFile As String)
    Dim sText As String, iFile As Byte
    iFile = FreeFile
    Open sFile For Input As iFile
    sText = Input(LOF(iFile), iFile)
    Close iFile
    Printer.Print sText
    Printer.EndDoc
End Sub
 
Usage:
Call PrintFile("C:\Autoexec.bat") 'This prints C:\Autoexec.bat on the default printer
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.