Consulting

Results 1 to 3 of 3

Thread: Macro to print to a specific printer (Word)

  1. #1
    VBAX Newbie
    Joined
    Sep 2007
    Posts
    1
    Location

    Macro to print to a specific printer (Word)

    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"*

    [VBA]
    Sub FaxPrint()
    Dim sCurrentPrinter As String

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

    End Sub
    [/VBA]

    Any help is greatly appreciated before I go mad

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

  2. #2
    [vba]
    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
    [/vba]

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

  3. #3
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    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!

Posting Permissions

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