Consulting

Results 1 to 6 of 6

Thread: Solved: Printout Problems

  1. #1
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location

    Solved: Printout Problems

    I have over 50 reports that I have to print to 5 different printers every morning. I use if statement to control what printer it goes to.

    I record a macro to get the code to print. However, Everyday, it give me an error saying that the activeprinter method fail. So I have to re-record a macro and paste it in again. When I re-record, the only thing i notice changing was "On Ne02:" it got change to a different port maybe "ON Ne10" or Ne08.

    Is there a way around this problem?

    [VBA]
    Application.ActivePrinter = "\\Printerserver\Printername on Ne02:"
    ActiveWindow.SelectedSheets.PrintOut Copies:=2, ActivePrinter:= _
    "\\Printerserver\Printername on Ne02:", Collate:=True
    [/VBA]

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can use the code in this KB item to get the port each time you print. The Userform is not required.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    thanks mdmackillop,

    Can you help me get this to work, I been messing with it for a couple hours now but it doesn't seem to do anything. There are 3 function but I can't figure with function to call first.

    thanks

  4. #4
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    I think i got it thanks

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You just need
    [VBA]
    Application.ActivePrinter = GetPrinterKey(PrinterName)

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    yup, go it, thanks

Posting Permissions

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