error macro run-time 1004

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

I have recorded a macro that simply selects a chart and
then prints. I did this for several charts in the
worksheet. I then added buttons so the user just has to
click the button to print a particular chart. I closed
this file and opened up today and each button I try has
run time error 1004 also with the words "Activate method
of chart object failed" What's up ??
Thanks for any help..........Will
 
Will said:
I have recorded a macro that simply selects a chart and
then prints. I did this for several charts in the
worksheet. I then added buttons so the user just has to
click the button to print a particular chart. I closed
this file and opened up today and each button I try has
run time error 1004 also with the words "Activate method
of chart object failed" What's up ??
Thanks for any help..........Will

Hi Will
maybe you can post the relevant part of your code - would be easier to
analyse :-)
Seems that there is a relative reference to you chart.

Frank
 
Oddly enough I think I may have stumbled on the problem,
maybe. The worksheet I have the buttons on was protected
because I have cells in another part of the sheet I didn't
want anyone to mess with. When I unprotected the sheet,
the buttons worked fine. I guess when a sheet is protected
you can't run macros.........true ??
Thanks again.....Will
 
Will said:
Oddly enough I think I may have stumbled on the problem,
maybe. The worksheet I have the buttons on was protected
because I have cells in another part of the sheet I didn't
want anyone to mess with. When I unprotected the sheet,
the buttons worked fine. I guess when a sheet is protected
you can't run macros.........true ??
Thanks again.....Will

Hi Will
you can run macros in general but I think they affect you protected
worksheet/chart. You may unprotect the sheet before running the macro
and protecting it again after running the macro. So something like

sub foo()
ActiveSheet.Unprotect
'.... your code here
ActiveSheet.Protect Scenarios:=True, UserInterfaceOnly:=True
end sub

Frank
 
Thanks for the help Frank........Will

-----Original Message-----


Hi Will
you can run macros in general but I think they affect you protected
worksheet/chart. You may unprotect the sheet before running the macro
and protecting it again after running the macro. So something like

sub foo()
ActiveSheet.Unprotect
'.... your code here
ActiveSheet.Protect Scenarios:=True, UserInterfaceOnly:=True
end sub

Frank

.
 
Back
Top