The worksheet is protected and the object(i.e. embedded graph) is protected. I want to print the graph with a macro but get the following error message:
"Run-time error '1004'
Activate method of ChartObject class failed."
Tried to use
Worksheets("Graph").Protect UserInterfaceOnly:=True
, but still does not allow printing of the graph as per code below.
Please help.
Tnx
Sub PrintGraph()
' Macro Prints the Graph on "Graph" sheet.
Worksheets("Graph").ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
With ActiveChart.PageSetup
.LeftMargin = Application.InchesToPoints(0.39)
.RightMargin = Application.InchesToPoints(0.39)
.TopMargin = Application.InchesToPoints(0.78)
.BottomMargin = Application.InchesToPoints(0.78)
.HeaderMargin = Application.InchesToPoints(0.39)
.FooterMargin = Application.InchesToPoints(0.39)
.ChartSize = xlFullPage
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.BlackAndWhite = False
.Zoom = 100
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Application.Goto Reference:="'Graph'!R4C1", Scroll:=True
ActiveWindow.Zoom = 85
End Sub
Bookmarks