Print path linked to cell

J

Jase

In a worksheet I am calling a printer from a cell on the worksheet itself.
The problem I am having is when I do this, the path name has to be very
specific. For example,1 of my printer option is "Main Printer on Ne03:". So
If I have my worksheet open on any other computer. I must reinstall all the
printers in a certain order, I believe this the "Ne03" portion of the path
and name them all exactly otherwise it debugs on me when I try to print.

I have to select the path from the sheet because I am doing a looping code
that goes back and forth between 2 sheets and printing them in a colation
fashion and I dont want to call the printer setup each time if i am trying to
print multiple versions.

Any other suggestion how to call the printer from my sheet without having to
give the exact path?

thanks,

Jase
 
H

Héctor Miguel

hi, Jase !

1) use constants for search/match your printers names according your output needs

2) build (and preserve) a sorted array of available printers (names only)...
this through -> CreateObject("WScript.Network").EnumPrinterConnections

3) find (from the sorted array) the index for the current printer (ActivePrinter)

4) search the index (in the sorted array) for the "target" printer name (constant/s in item 1)

5) back/forward for matching index differences using SendKeys ONE instruction line PRIOR to...
show the printer selection dialog: -> Application.Dialogs(xlDialogPrinterSetup).Show
(this should be "almost" invisible to the GUI and disregarding the applicable port connection)

6) perform your printing instructions

-> repeat steps 3 to 5 for any printer change needs (at the end, return to the "original" ActivePrinter)

hth,
hector.

__ OP __
 

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