Hi All,
How do you print a simple Text file through code?
Printable View
Hi All,
How do you print a simple Text file through code?
Code:Open "File.txt" For Input As #1
strTemp = Input(LOF(1),1)
Printer.Print strTemp
Printer.EndDoc
Close #1
Get up to get a tea and someone beats you to the punch! :D
Code:'Read a complete file instead of line by line
Option Explicit
Private Sub Command1_Click()
Dim sfile As String, intNum As Integer
Dim sString As String
intNum = FreeFile
sfile = "C:\my Documents\myfile.txt"
Open sfile For Input As intNum
sString = StrConv(InputB(LOF(intNum), intNum), vbUnicode)
Close intNum
Printer.Print sString
Printer.EndDoc
End Sub
:D
Thanks to both of you.