borderAndreaVB free resources for Visual Basic developersborder
AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincani
:: Print a Text File

Author  

Andrea Tincani

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
Module

Option Explicit

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

:: Navigation

Home

Printing Using Visual Basic

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 12-06-2017 Printing invoice in contiinous paper using USB Dot matrix printer by imagetvr
icon 09-10-2013 Transfer SMS to iPhone 5S from iPhone 3GS/4/4S/5 by Vagety
icon 22-06-2013 Automatic Image ID creator by seejr
icon 22-06-2013 Automatic Image ID creator by seejr
icon 12-03-2013 Barcode 3of9 ASP.NET Custom Control by ScottGray
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincaniborder