Print File

Preparations

Add 1 Text Box to your form.
Set the Text Box's MultiLine property to True, and the
Text Box's Visible property to False.

Form Code

Private Sub Form_Load()
    Dim file As String

'Replace 'c:\autoexec.bat' with the file you want to print
    file = "c:\autoexec.bat"
    Open file For Input As #1
    Text1.Text = Input(LOF(1), #1)
    Close
    Printer.Print Text1.Text
    Printer.EndDoc

End Sub

Go Back