
Excel VBA Q: Error 1004 Method method of Object class failed?
Feyas ) says:
Quote:
> I am trying to run the following VBA macro in Excel:
> Sub cmdPrint_Click()
> Sheets("MySheet").Select
> ActiveSheet.PrintOut
> End Sub
> If I run the macro from the module or from the
> toolbar it works fine. However if I try to assign
> the macro to a button on a dialogsheet I get runtime
> error: 1004 "Printout method of Worksheet class
> failed" when I click on the button.
I think, off the top of my head, its because the activesheet is now the
dialogue sheet and not the one it was when you run from the module. I'd
assume dialogue sheets don't understand the method.
You may want to change the reference to activesheet, perhaps, to a named
sheet, to be sure you refer to the correct sheet.
This is just a guess based on similar problems in the past.