Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-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!

*Tek-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

VBA Visual Basic for Applications (Microsoft) FAQ

Excel How To

How to Find the Ne Printer Number in Excel VBA by sxschech
Posted: 22 Aug 11

If you print to a specific printer through vba and refer to the printer via its Ne0 number, this will help allow the printer code to work without hard coding the number.

For example: If "Adobe PDF on Ne04:" becomes "Adobe PDF on Ne05:", the code will produce an error.  This can happen if new printers are added or if the code is run on multiple computers.

The following link contains a function that will identify the Ne0 number of a given printer:


Copy and paste the code into an excel visual basic module.

In the actual macro/code for doing the printing, make the following change:


Application.ActivePrinter = "Adobe PDF on Ne04:" 'or whatever Ne0 number it is



Application.ActivePrinter = FindPrinter("Adobe PDF") 'or whatever the name of the printer to use as the active printer

You can also use the FindPrinter function from the immediate window as well in order to find out the printer number by providing the name of the printer which can be found in the Devices and Printers section of Control Panel.    

Back to VBA Visual Basic for Applications (Microsoft) FAQ Index
Back to VBA Visual Basic for Applications (Microsoft) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close