S
Scott
I am writing a VB routine to copy a chart from 20 workbooks to a new single
worksheet in a new workbook. I will also update the charts in the new
workbook perodically. The following will be called 20 times with a different
Oneof20 and ChartLoc.
Sub CopyGraph (Oneof20 As String, ChartLoc As String)
'
' Open workbook
Workbooks.Open Filename:= Oneof20
Windows(EachFile).Activate
Sheets("XYZ").Select
'
'Copy new chart
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
'
' paste new chart
Windows("ALL.xls").Activate
Sheets("20Charts").Select
Range(ChartLoc).Select
ActiveSheet.Paste
'
' change chart title
ActiveSheet.ChartObjects(ChartName).Activate
..
..
..
How can I determine what ChartName is? If I do the "copy the 20 charts" a
2nd time (say a month later), I will have to delete the original 20 charts
first. How do I get the names of those 20 charts so I can reference them to
delete?
worksheet in a new workbook. I will also update the charts in the new
workbook perodically. The following will be called 20 times with a different
Oneof20 and ChartLoc.
Sub CopyGraph (Oneof20 As String, ChartLoc As String)
'
' Open workbook
Workbooks.Open Filename:= Oneof20
Windows(EachFile).Activate
Sheets("XYZ").Select
'
'Copy new chart
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
ActiveWindow.Visible = False
'
' paste new chart
Windows("ALL.xls").Activate
Sheets("20Charts").Select
Range(ChartLoc).Select
ActiveSheet.Paste
'
' change chart title
ActiveSheet.ChartObjects(ChartName).Activate
..
..
..
How can I determine what ChartName is? If I do the "copy the 20 charts" a
2nd time (say a month later), I will have to delete the original 20 charts
first. How do I get the names of those 20 charts so I can reference them to
delete?