PDA

View Full Version : Macro to print to a specific printer (Word)



Double
09-06-2007, 04:33 PM
Wasnt sure where to post this though this was the most accurate Forum.

I have this code and I get a Run Time 5216 Error - There is a printer error.

This is my code and it stops on the *ActivePrinter = "Zebra"*


Sub FaxPrint()
Dim sCurrentPrinter As String

On Cancel GoTo Cancelled:
sCurrentPrinter = ActivePrinter
ActivePrinter = "Zebra"
Application.PrintOut FileName:="label.dot"
Cancelled:
ActivePrinter = sCurrentPrinter

End Sub


Any help is greatly appreciated before I go mad

Edited 7-Sep-07 by geekgirlau. Reason: insert vba tags

vksingh24
09-06-2007, 09:58 PM
Sub FaxPrint()
Dim sCurrentPrinter As String

On Cancel GoTo Cancelled:
sCurrentPrinter = ActivePrinter
ActivePrinter = PUT COMPLETE NETWORK PATH HERE ex: \\xxx\XEROX
Application.PrintOut FileName:="label.dot"
Cancelled:
ActivePrinter = sCurrentPrinter

End Sub


Edited 7-Sep-07 by geekgirlau. Reason: insert vba tags

geekgirlau
09-06-2007, 11:13 PM
Hi guys (and Double, welcome to the Board!)

When you post code, please use the vba tags (select your code text and click on the "VBA" button) - I've edited your posts so you can see what this looks like.
Nice to see new converts posting answers vksingh24!