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!

Printing to Network Printer

Status
Not open for further replies.

FLWong

Programmer
Jul 27, 1999
2
0
0
SG
Hi,<br>
How do I print to a network printer from my VB program? I am using the Open statement to open the network port for Output followed by a Print statement to the file handle for the network printer. However, the print job was not printed. How do I go about doing this? The method does work for my local printer. Any help will be greatly appreciated.
 
You don´t need to do that anymore in VB, you can use the printer object and then use the printer.print method to print to the printer you want<br>
I saw an example somewhere in the book <br>
<br>
dim x as printer<br>
<br>
x = thenetwork printer<br>
<br>
<br>
set printer = x<br>
<br>

 
if you code printer.print "Hello" Hello will be sent to DEFAULT printer. If this is not what you want you could use a common dialog box using the showprinter method to allow the user to select a printer. or query the printer collection as mentioned above for a printer that meets your criteria and the use the set printer = x when your routine finds a match
 
Hi,<br>
Thanks for the replies. Am I right to say that in the reply by hug, "thenetwork printer" refers to the network printer name?<br>
How do I ensure that the printer do not format the text at all. I want to print some files which must not be formatted at all. That is, the output must look like that printer in DOS mode!<br>
Once again, thanks.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top