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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending a single line to the default printer

Status
Not open for further replies.

GVF

Programmer
Feb 25, 2005
160
US
I am collecting data (over the course of a month) through the serial port and pasting it into Excel. The computer collecting the data is unattended. I need to send each line of data to the printer as well so I have hard copy in case something bad happens to the computer. The printer would then wait patiently for the next line of data (doesn't spit out the sheet until the sheet is full).
I ran across a snippet of code that accomplishes this, but I've lost it. I seem to recall that it involved a command used in older versions of visual basic.

Something like...
StringToPrint = "Hello" & vbCR
PRN StringToPrint

GVF
 
Mystring = "Hello"
Printer.print Mystring

Should print Mystring to the default printer

Count the lines printed and Add a;

Printer.EndDoc

when you want a page ejected


 
Thanks for the help. I am coding in VBA and thought I would try this forum just in case. Didn't work.

GVF
 
I don't think anything will print until you send Printer.Newpage or Printer.EndDoc.

[gray]Experience is something you don't get until just after you need it.[/gray]
 
My suggestion will not work in VBA, which does not support the Printer Object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top