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

Is there a way to select a network printer before Userform1.Printform

Status
Not open for further replies.

Forrest77

Technical User
Apr 5, 2006
31
US
In My Excel Application, I have various Userforms that will need to be printed from different network printers. The printer I need to select is a network label printer.
I have looked all over this site and others for some example that I can tweak to my needs but thus far have come up with nothing that works. I thought I could perhaps change the default printer back either by script or manually as I need it. Any ideas? Thanks again for your help.
Also Congrats to PHV for Tipster of the Month. His info is good and has helped me before.
Thanks
 
Have a look at the Application.ActivePrinter property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH,
Not having much luck so far. I tried various reditions of the Application.ActivePrinter. The Nws41479 is the name of the pc that has the shared printer on the network.

Application.ActivePrinter = "\\Nws41479\Zebra DA402"

Application.ActivePrinter = "\\Nws41479\Zebra DA402 on Ne03:"

Application.ActivePrinter = "\\Zebra DA402"

Application.ActivePrinter = "Zebra DA402"
Will keep plugging unless you see something that I am missing. I may have to connect this printer to the pc that runs the excel application if it won't go network..

Thanks,
Todd
 
Works for me.
I first set the printer as the default one to discover its name (? ActivePrinter).
Then I reset my ordinary default printer, relaunch Excel and play with the ActivePrinter property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yep, I tried that. I made it the default and then when it was yellow and I held the mouse over the yellow debug over the Application.ActivePrinter part, it shows the default I had just chosen. I made sure I copied it exactly like it was but I'll try again and keep playing with it.
Thanks,
Todd
 
PHV,
I think I know the problem. Your code works with any of the excel sheets that I may want to print but when printing a userform, it doesn't seem to apply. If I let it print any sheet that I select as active, it works just fine. Now I need to figure out how to switch it for userforms....
Todd
 
I'm using an access database where I would like to use this same concept (Applications.ActivePrinter), but I don't think I have the proper references set to use this. Does anyone know what reference is necessary to retrieve the name of the default system printer in Access VBA?

Thanks,
Erich
 
Application.Printer.DeviceName

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the response PHV. Unfortunately I'm still getting a "method or data member not found" error. Do you know if I need to set a reference to use this?

Erich
 
That's the problem, my database is Access 2000. Do you know how to do it in 2000?

Erich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top