Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

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

Join Tek-Tips
*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.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Unable to set the active printer property of application class

RH610 (Programmer) (OP)
2 Dec 02 11:08
The following VB5 code works (Word2002):

Dim WordApp As Object
Set WordApp = CreateObject("Word.Application")
WordApp.ActivePrinter = "test"

The following VB5 code gives
Unable to set the active printer property of application class (Excel2002):

Dim ExcelApp As Object
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.ActivePrinter = "test"

Thank You
unica (Programmer)
3 Dec 02 17:38
the only thing i can think of that could cause the problem is that excel maybe wants the whole printer name (including portname).

You could try the following:
set test as default printer, open excel VBA editor, create a test procedure:

Public Sub test()

    strprinter = Application.ActivePrinter
    Application.ActivePrinter = strprinter

End Sub

Step through this code, see what name is given to strprinter and see if the line Application.ActivePrinter = strprinter will work. If this works then you know what should be the exact printername you have to put into your code.

hope this helps.
Nikita6003 (Programmer)
4 Dec 02 2:13
Hiya RH610

This comes from an XL application I use to create a series of postscript files from an Excel report.

Application.ActivePrinter = "Acrobat Distiller on Ne00:"

I have to use the port on which the printer can be found for it to work; the NE00 is one of the ports on a network print server

Check your test printer's properties for the port it uses

Hope this helps


Reply To This Thread

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

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

Back To Forum

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