locked
Word 2010 do not return activeprinter portnumber RRS feed

  • Question

  • 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.

    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.

    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

    Wednesday, November 23, 2011 6:52 AM

Answers