ActiveSheet.PrintOut - problem

Discussion in 'Microsoft Excel Programming' started by Derek T., Feb 20, 2004.

  1. Derek T.

    Derek T. Guest

    Hello,
    Someone created an excel file with some fancy
    stuff. On menu like window there are buttons
    for printing reports. When I try to use them, all
    I get is an error message
    "Run-time error '1004'
    Printout method of worksheet class failed"
    if I try to debug it points to "ActiveSheet.PrintOut"
    line.
    Any idea how to fix it?
    Thank you
     
    Derek T., Feb 20, 2004
    #1
    1. Advertisements

  2. Derek T.

    Mike Guest

    There are probably a number of possibilities for this
    depending on what the code is doing before the PrintOut
    statement.
    For example, it is possible for no sheet to be Active.
    Place the following line before the PrintOut line:
    msgbox ActiveSheet.Name

    You may need to post more information about the routine.
     
    Mike, Feb 20, 2004
    #2
    1. Advertisements

  3. Derek T.

    Derek T. Guest

    Thanks Mike,
    Whole menu starts with a dialog window, which
    contains some buttons. Those buttons have macros assigned. If I run just
    macro, everything is fine.
    macro sample:
    Sub Cdncust_report()
    'Application.ExecuteExcel4Macro String:="Report Manager"
    'Application.ExecuteExcel4Macro String:="Report Manager"
    'Application.ExecuteExcel4Macro String:=" REPORT.PRINT(""Cdn Customer
    Package"",1)"
    Sheets("Project Information").Activate
    ActiveSheet.PrintOut
    Sheets("Design Basis [Cdn]").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Sheets("Scrubber Specification [Cdn]").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Sheets("Costs [$Cdn]").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Worksheets("Project Information").Activate

    End Sub
    I created new Dialog window (Right click on the worksheet tab at the bottom,
    insert, Dialog)
    added one button and assign simple macro:
    "Application.Goto Reference:="Reports!R14C5" "
    still wouldn't work, I got " Method 'Goto' of object '_Application"
    failed

    ????
    Derek T.
     
    Derek T., Feb 20, 2004
    #3
  4. Derek T.

    Derek T. Guest

    Thanks Mike,
    Whole menu starts with a dialog window, which
    contains some buttons. Those buttons have macros assigned. If I run just
    macro, everything is fine.
    macro sample:
    Sub Cdncust_report()
    'Application.ExecuteExcel4Macro String:="Report Manager"
    'Application.ExecuteExcel4Macro String:="Report Manager"
    'Application.ExecuteExcel4Macro String:=" REPORT.PRINT(""Cdn Customer
    Package"",1)"
    Sheets("Project Information").Activate
    ActiveSheet.PrintOut
    Sheets("Design Basis [Cdn]").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Sheets("Scrubber Specification [Cdn]").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Sheets("Costs [$Cdn]").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Worksheets("Project Information").Activate

    End Sub
    I created new Dialog window (Right click on the worksheet tab at the bottom,
    insert, Dialog)
    added one button and assign simple macro:
    "Application.Goto Reference:="Reports!R14C5" "
    still wouldn't work, I got " Method 'Goto' of object '_Application"
    failed

    ????
    Derek T.
     
    Derek T., Feb 23, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...