Choosing a Printer via VBA

  • Thread starter Thread starter Peter Marshall at OCC
  • Start date Start date
P

Peter Marshall at OCC

When I record a VBA macro within Excel to choose a particular shared network
printer, I get the following code:

Application.ActivePrinter = "\\SERVER1\HP Laserjet 5Si on Ne08:"

This works fine on my PC because this printer somehow is the Ne08 printer on
my PC. But when I run this macro on another PC, it fails because it is not
the Ne08 printer on that PC. Is there a way within VBA to specify the
printer by its Share Name ("HPLJ5si") so this will work from any PC that is
mapped to that shared printer?

I need this macro to choose the printer because I have another macro that
needs to choose a PDF "printer" as well.
 
Why not just use the printer dialog and let the user choose?


Application.Dialogs(xlDialogPr­int).Show
 
Hey Bob, that works just fine. Thank you!

Bob Phillips said:
Why not just use the printer dialog and let the user choose?


Application.Dialogs(xlDialogPr­int).Show


--
HTH

Bob Phillips

printer
 
Back
Top