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

Output to printer

Status
Not open for further replies.

joerocket

Programmer
Nov 22, 2000
35
0
0
US
Hey Gang,

Is there a VBScript command to send output to a printer?

I've searched hi and low in my Win2000 Scripting Guide, but not found anything.

Thanks,

Jacob
 
Depends I guess on what you want to print and to where.

I wrote a script that prints mailing labels by writing to a local LPT port using the FileSystemObject. Relative excerpts follow:

Set FSO = CreateObject("Scripting.FileSystemObject")
Set objPrinter = FSO.CreateTextFile("LPT1:", True)
...
objPrinter.WriteBlankLines 1
objPrinter.WriteLine(MAILCODE)
objPrinter.WriteLine(ADDRESSEE)
objPrinter.WriteLine(ADDRESS_LINE1)
objPrinter.WriteLine(CITYSTZIP)
objPrinter.WriteBlankLines 4
objPrinter.Close

Note that this prints UNFORMATTED text to the printer. It's like doing a copy of a text file to the printer. I.E.: "copy mytextfile.txt LPT1"

Other methods I've seen use HTML and COM objects to control IE to print, but I do not have any practical experience doing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top