Print a Text File

Can I print a .txt file without opening it first? No formatting or page breaks are required. All I would need is for the program to print a predetermined file name and quit.
DonH040699Asked:
Who is Participating?
 
kamallCommented:
Open "c:\myfile.txt" For Input As #1
Do while Not Eof(1)
   Line Input #1, x$
   Printer.Print x$
Loop
Close 1
Printer.EndDoc

0
 
KDivadCommented:
Without opening it? Sure, if you don't mind "bouncing" it off command.com.

x = Shell("command /c copy " & MyFile & " lpt1")
0
 
DonH040699Author Commented:
Kamall,

I put your suggested code in a function and it worked great. VB showed me what else I could do with Print. and I wound up with a very useful untility. Thanks!
0
 
kamallCommented:
You are welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.