Print to selected port, instead of selected printer?

G

GrannyM

Each of our departments have a different label printer, but they are all set
up on lpt3. We have a label macro that is used by these departments and we
would like to have that macro automatically print to lpt3. Is there a way to
set the activeprinter to the lpt3 port without using the printer name?
 
R

ryguy7272

I use this:
Application.Dialogs(xlDialogPrinterSetup).Show

I don't like printing to a specific printer because if any printer goes
down, you don't have to fiddle around with code to select different
destination printers. Anyway, I think it is easier for end users.

Regards,
Ryan---
 
G

GrannyM

Thanks, but they do not want me to show a dialog box. To quote: "if they
only have 1 label printer and it's always mapped to lpt3, why should they
have to choose it, just automatically print the label to lpt3."
 
D

Doug Robbins - Word MVP

Rename all of the label printers as "LabelPrinter" and then have the code
select that printer name.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

GrannyM

That's what my solution was, or at least have "Label Printer - printer name"
so that I could pull it using Instr(), but my tech support person keeps
telling me there has to be some way of selecting LPT3.

Thanks anyway
 
J

Jean-Guy Marcil

GrannyM said:
Each of our departments have a different label printer, but they are all set
up on lpt3. We have a label macro that is used by these departments and we
would like to have that macro automatically print to lpt3. Is there a way to
set the activeprinter to the lpt3 port without using the printer name?

Basically, you need to scan the list of available printers detected by Word
on the user machine. Then, scan the ports in that list to get the printer
name associated with the targeted port. Store the currently active printer.
Set the active printer to the one the code detected as being active on the
targeted port. Print. Then reset the printer that was active before your code
ran.

See
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=183
for code on getting printer information, including the port name...
 
G

GrannyM

That's what I needed, although I will have to say that Doug's solution of
looking for a printer with "label" in the name is much simplier. But if they
insist that I print to LPT3, now I can do so. (Of course, this means I have
to tell him he was right all along!) ;-)

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top