borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 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-05-2008 Re: Printer.? by stickleprojects
icon 12-05-2008 Re: Printer.? by stickleprojects
icon 12-05-2008 Re: Printer.? by BobBarker
icon 10-04-2008 Re: Reading modifing text files by admin
icon 10-04-2008 Re: Reading modifing text files by admin
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder