-
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]
-
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'
-
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
-
I think i got it thanks
-
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'
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules