ActiveSheet.PrintOut - problem

D

Derek T.

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
 
M

Mike

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.
 
D

Derek T.

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.
 
D

Derek T.

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Print a Chart worksheet 9
Printing problem 3
PrintOut_Method 3
Run-time error when copying entire row! 5
excel 2ooo macro 3
Application crashed on print 1
Printing hidden sheets with vba. 5
If page does not exist 7

Top