Public Sub PrintTXTFile(FileName As String)
Dim x As Integer
Dim s As String
x = FreeFile
On Error GoTo HandleError
Open FileName For Input As x
Do While Not EOF(x)
Line Input #x, s
Printer.Print s
Loop
Printer.EndDoc
Close #x
Exit Sub
HandleError:
MsgBox "Error :" & Err.Description, vbCritical,
"Printing File..."
End Sub
Usage
'Usage :
Private Sub Command1_Click()
PrintTXTFile "C:\logon.reg"
End Sub