Share via

.activeprinter do not return port name

Anonymous
2011-11-22T12:31:14+00:00

I work om migrating vba code from 2003 to 2010 og have got a problem.

In 2003 i use application.activeprinter to return the printername and the port name. I use it with the windows api DeviceCapabilities Lib "winspool.drv" to get the traynames and traynumbers for the active printer. Reciving this i can setup the page to printout on the right paper.

In word 2010 i do not get the portname for a network printer - only the printername, and i need the portname to use the Windows api.

I can get the portname when using a excel object to get the .activeprinter but i realy feel it is to slow.

Is her any other ways around?

Can i solve the problem with SP1?

Thanks

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-11-23T01:11:16+00:00

You may try to change the port number by following the steps below:

Click start >  Go to Devices and Printers > Right click on Default Printer > Go to Printer Properties > Click the Ports Tab and you can add or change the ports over there.

If the computer is on a Network, please contact your Network administrator.

For better suggestions on the same, post your question in the forum below:

http://social.technet.microsoft.com/Forums/en/word/threads

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-01-05T15:56:48+00:00

    I have exactly this problem - did you find a solution?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-11-23T06:46:29+00:00

    Thanks for your reply.

    We have 2 types off printers on our network. Abount 80 printers total. In my template code i have to find out: Is it printertype A or printertype B the user have as active printer. When i know that i can set up the page to print out on the letterhead paper. This may bee eg tray number 1269 for type A or tray number 1072 for type B. I can find the tray names and numbers from the windows API DeviceCapabilities functions, but it neads the device name and the port number for a network printer.

    Word 2010 return the device name with .activeprinter, but not the port number. How can i get this?

    Hope the question is clear enough.

    Was this answer helpful?

    0 comments No comments