Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a log file?

Status
Not open for further replies.

demoniac

Programmer
Jun 14, 2001
63
US
Hello, I've got a program that creates a log file of the users actions. Once they're finished with it, I need to print it out but I can't exactly figure out how. I thought it was printer.print logFileNumber, but that doesn't work. Can somebody help me? :eek:)

Thanks,
demoniac
 
You could always:
Dim sLine As String
Dim sOutput As String
Dim i As Integer

i = FreeFile

Open "C:\MyLogfile" For Input As i
Do Until EOF(i)
Input #i, sLine
sOutput = sOutput & sLine & vbCrLf
Loop
Printer.NewPage
Printer.Print sOutput
Printer.EndDoc
 
Thanks woyler :) When I try to do it I get a printer error, though. Is there something else I should be doing that I'm missing? (I do have a printer installed and set to default, btw)

Any ideas?
 
Woyler,
Nevermind, the code you gave me works perfect, I forgot I was trying to run it on my laptop and not my desktop (printer isn't installed on laptop). hehe :eek:)

Thanks for your help
demoniac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top