Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Application object failed while trying to print

Latest post Thu, Jun 19 2008 6:48 PM by Nick Hodge. 1 replies.
  • Thu, Jun 19 2008 4:13 PM

    • venu
    • Top 75 Contributor
    • Joined on Tue, Jun 3 2008
    • Posts 4
    • Points 100

    Application object failed while trying to print

    Dear All  ,

    i was trying to execute this code and found that the code would just run fine the first time i run it  and sometimes not , the error it throws  is as follows ..........................i tested the printers and they were just working fine..........

    any guesss?

    Thank you all for your suggestions and comments.................

    *************************************************************************************************************************************

    Run time error ' 1004 '

    Method 'Active printer ' of object  '_Application' failed

    ***************************************************************************************************************************************

     

    With wksCurrent
                   .Application.Calculation = xlCalculationAutomatic
                   .EnableCalculation = True
                   .PageSetup.PrintArea = "$A$1:$O$107"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        Application.ActivePrinter = "printer#1 on Ne01:"
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
            "printer#2 on Ne01:", Collate:=True
    With .Range("A1:Q112")
                       .Copy
                       .PasteSpecial (xlPasteValuesAndNumberFormats)
    End With

     

     

    Filed under: ,
    • Post Points: 21
  • Thu, Jun 19 2008 6:48 PM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 242
    • Points 4,017
    • MVP

    Re: Application object failed while trying to print

    Venu

    Excel has a habit of choking on print interactions as VBA has to interact with the print driver. Have you tried an Application.Wait statement to stall the execution of the second print? say for 30 seconds?

    Also, does it have the same issue on local printers? Say printing twice to the same printer. If so it is the swapping that is the issue. Just a couple of things to try

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright Excel User Group and the relevant contributors, 2008. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.