Results 1 to 3 of 3
  1. #1
    geth
    Guest

    Word 2000 and Printers

    Hello and Happy New Year!

    Can anyone help me with this one?

    This is Word 2000 on Win 2000.

    Basically, I've got a bit of code that needs to do some printing on a specific network printer.

    Thing is that although every PC that will run the code has the right type of printer installed, it will often have a slightly different name on each one - eg LAB01-ABC; LAB02-XYZ; LAB22-EFG; etc...

    I could obviously display a standard print dialog for the user to pick from but that isn't really ideal for what we're doing.

    I therefore need to access a list of the printers installed on the pc running the macro code (there will be at least two printers to choose from) and use the one with the right name pattern for the print job.

    I can't find anything in VBA to do this.

    I've had a crack at EnumPrinters from the Windows API (which seems at first glance to be ideal) but, even though I've found some documentation, I don't know enough about it to get any joy from it.

    Anyone else ever needed to do this? Am I missing something simple? Anyone got some code samples for EnumPrinters, even?

    Many thanks for any help.

    Gethyn

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2000 and Printers

    Just a suggestion:
    We used to run Winfax which had macros for finding the right printer by accessing the registry. I think Winfax lite is included with Office 2K (?) but am not sure if the macros are included with that version.
    I started disecting the code for another purpose and had some success in re-writing it - unfortunately the pc it is on is not immediately accessible.
    Considering the talent that responds to this forum I would be surprised if you don't get help on this one but I'll dig it out if none is forthcoming - at least it may give you a leg up.

  4. #3
    geth
    Guest

    Re: Word 2000 and Printers

    Leif, thanks for your help.

    The WinFax thing was done by accessing the registry which didn't quite work the way I wanted (almost, but not quite).

    Ended up using EnumPrinters from the Windows API.

    Wouldn't have been able to do it without coming across a chance link to this MSKB article:

    http://support.microsoft.com/kb/articles/Q166/0/08.asp

    (Article ID: Q1660008)

    It's actually intended for Access 97 but I just hacked out the PRINTER_INFO_4 declarations and code and plopped it all into Word and it works a treat.

    Wouldn't have had a cat's chance on my own though..!

    Cheers

    G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •