×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How do I choose a network printer in a macro?

How do I choose a network printer in a macro?

How do I choose a network printer in a macro?

(OP)
I have a macro which will print an excel worksheet. I have installed it on another computer in our network but the local printer for that computer is an older model which will not print borders around excel cells or print color.

How can I have this Excel macro choose a specific network printer rather than the default printer. Currently we have to manually change the default printer before running the macro.

An alternate plan is to get the older printer (HP Laser Jet III) to print the borders and use shading in place of colors.

Any help is appreciated.

RE: How do I choose a network printer in a macro?

I am not a VBA espert, but I guess that you can execute a external program.

Just execute
rundll32 printui.dll,PrintUIEntry /y /n "printer" /q
for setting the printer you wish as default.

Print

at the end of your macro just repeat again for re set the right one.

RE: How do I choose a network printer in a macro?

(OP)
Thanks for the tip Melko. But I stumbled across another solution while I was trying to write in the code you supplied.

Application.ActivePrinter = "[Printer & path]"

It all seems so simple now.

bpeirson.

RE: How do I choose a network printer in a macro?

Using the xlDialogPrinterSetup will display a dialog with all network printers available.  The selected printer will then be set as the default.

' Display printer setup dialog
Application.Dialogs.Item(xlDialogPrinterSetup).Show

Hope this helps
Dave

RE: How do I choose a network printer in a macro?

(OP)
Thanks, where can I find a list of xlDialogs which are accessible to me in VBA.

Brad

RE: How do I choose a network printer in a macro?

If you open the VBA editor and then open the object browser (From the main mene click View, Object browser). Then type "xldialogs" in the search box, hit enter.  This should display all the xldialogs available

hope this helps

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources