M
Maria High
Hi,
I have a sheet where I in Worksheet_Activate copy all chartobjects and paste
them as pictures and then hide the chartobjects. This make the users not
able to ruin the references in the charts.
Problem: I get two copies of pictures...why????
She sheet1 had to have a couple of charts. Code:
Sub CopyChart()
Dim chtobj As ChartObject
Dim W As Double
Dim H As Double
Dim T As Double
Dim L As Double
ActiveSheet.Unprotect
ActiveSheet.Pictures.Delete
For Each chtobj In Sheet1.ChartObjects
W = chtobj.Width
H = chtobj.Height
L = chtobj.Left
T = chtobj.Top
chtobj.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ActiveSheet.Pictures.Paste.Select
With Selection
.Width = W
.Height = H
.Left = L
.Top = T
End With
Next chtobj
ActiveSheet.ChartObjects.Visible = False
Exit Sub
/Regards
I have a sheet where I in Worksheet_Activate copy all chartobjects and paste
them as pictures and then hide the chartobjects. This make the users not
able to ruin the references in the charts.
Problem: I get two copies of pictures...why????
She sheet1 had to have a couple of charts. Code:
Sub CopyChart()
Dim chtobj As ChartObject
Dim W As Double
Dim H As Double
Dim T As Double
Dim L As Double
ActiveSheet.Unprotect
ActiveSheet.Pictures.Delete
For Each chtobj In Sheet1.ChartObjects
W = chtobj.Width
H = chtobj.Height
L = chtobj.Left
T = chtobj.Top
chtobj.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ActiveSheet.Pictures.Paste.Select
With Selection
.Width = W
.Height = H
.Left = L
.Top = T
End With
Next chtobj
ActiveSheet.ChartObjects.Visible = False
Exit Sub
/Regards