PDA

View Full Version : Solved: ActivePrinter



smugdruggler
06-17-2006, 01:45 PM
Ok! I have a ss that I create a report, print it and also print labels from captured data. This works great on my PC as I use the ActivePrinter option to switch printers to the label printer ie. Sheets("1").Printout ActivePrinter :="Dymo". However I now have to let a couple of other guys use this ss, and after printing the label I would like Excel to revert back to their default printer. Otherwise I would have to change the code for each individual.

Any help gratefully accepted.

lucas
06-17-2006, 06:41 PM
Maybe you could use Application.ActivePrinter
See this thread for ideas and search the forum for printer. This has been discussed before but I don't remember much about it. The knowledgebase also has several entries dealing with printer selection

http://www.vbaexpress.com/forum/showthread.php?t=3589&highlight=printer

smugdruggler
06-18-2006, 05:02 AM
Thanks Lucas,

Loads for me to look at to find a fix. I'll mark this solved for now and get back if I need to

mdmackillop
06-18-2006, 05:15 AM
The KB Item here http://vbaexpress.com/kb/getarticle.php?kb_id=528 contains code to change a printer. It looks complicated, but the main function should not require any changes, its sole purpose is to add the port (or whatever it is) that a named printer uses. ie MyPrinter on Ne01: Unfortunately, this can be different for each PC for the same printer.
Let us know if you need help implementing this.

smugdruggler
06-18-2006, 10:15 AM
Thanks MD, I'll have a look :o)

smugdruggler
06-19-2006, 12:51 AM
Hey MD,

Thanks for the link, thats a pretty scary peice of code for a newbie like me! It works a treat.

It's still not quite what I'm looking for because the code requires that I know what the names of the printers are called on the PC that the code is running on.

All I need is that when I have printed a label using the Printout.ActivePrinter method, the Active printer is returned to whatever the user has selected as his default windows printer.

I can of course get around this by installing printers on their PC with generic names and writing the code to suit, but there must be a cuter way to do it...If I was clever enough.