J
justme0010
I have code that creates a chart in Excel and moves that chart to a
certain sheet. This code works in my home Access 2003 (and Excel 2003),
but not from Access 2000 (and Excel 2000), which I need it to work from.
It just creates and leaves it in the existing "Sheet1." I want it to be
in the existing "ReportCharts." What could be wrong?
The line in question is
..ActiveChart.Location Whe=xlLocationAsObject, Name:="ReportCharts"
The library references seem to be intact in both versions. This is the
full section of code:
With objExcel
..Charts.Add
..ActiveChart.SetSourceData Source:=.Sheets("Chart
Data").Range("A" & intTitleRow & _
":M" & intCurYearRow), _
PlotBy:=xlRows
..ActiveChart.Location Whe=xlLocationAsObject,
Name:="ReportCharts"
With .ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = Years(i)
..Axes(xlCategory, xlPrimary).HasTitle = True
..Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
"MONTH"
..Axes(xlValue, xlPrimary).HasTitle = True
..Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "COST"
..HasDataTable = False
End With
End With
certain sheet. This code works in my home Access 2003 (and Excel 2003),
but not from Access 2000 (and Excel 2000), which I need it to work from.
It just creates and leaves it in the existing "Sheet1." I want it to be
in the existing "ReportCharts." What could be wrong?
The line in question is
..ActiveChart.Location Whe=xlLocationAsObject, Name:="ReportCharts"
The library references seem to be intact in both versions. This is the
full section of code:
With objExcel
..Charts.Add
..ActiveChart.SetSourceData Source:=.Sheets("Chart
Data").Range("A" & intTitleRow & _
":M" & intCurYearRow), _
PlotBy:=xlRows
..ActiveChart.Location Whe=xlLocationAsObject,
Name:="ReportCharts"
With .ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = Years(i)
..Axes(xlCategory, xlPrimary).HasTitle = True
..Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
"MONTH"
..Axes(xlValue, xlPrimary).HasTitle = True
..Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "COST"
..HasDataTable = False
End With
End With