J
Joseph Felcon
Hello,
I am getting a run-time 1004 error when trying to program properties for a
chart. Actually, it is the second chart which I create which is invoking
the error message.
I am creating multiple worksheets, each with one chart. The first worksheet
and chart work fine, but the second and third worksheet/chart cause 1004
errors on certain property values...
' create a new worksheet for chart flow
Application.DisplayAlerts = False
Set wsChartFlow = Worksheets.Add
wsChartFlow.Name = "Chart Flow"
' create the chart flow object
Set coFlow = wsChartFlow.ChartObjects.Add(0, 0, 800, 600)
coFlow.Name = "Net Flow over Time"
Set chFlow = coFlow.Chart
Application.DisplayAlerts = True
' add data to chart for Flow
chFlow.HasTitle = True
chFlow.ChartTitle.Caption = "Net Flow over Time"
chFlow.ChartType = xlXYScatterLines
chFlow.PlotBy = xlColumns
.... HEREIN I ADD SERIES AND GENERALLY FORMAT THE CHART TO MY LIKING ...
.... I ORIGINALLY TRIED ...
' create a new worksheet for chart fuel
Application.DisplayAlerts = False
Set wsChartFuel = Worksheets.Add
wsChartFuel.Name = "Chart Usage"
' create the chart fuel object
Set coFuel = wsChartFuel.ChartObjects.Add(0, 0, 5 * iCopy * m_iSelected,
600)
coFuel.Name = "Fuel Use over Time"
Set chFuel = coFuel.Chart
Application.DisplayAlerts = True
' add data to chart for Fuel
chFuel.HasTitle = True
chFuel.ChartTitle.Caption = "Fuel Use over Time"
chFuel.ChartType = xlColumnClustered
chFuel.PlotBy = xlColumns
.... IN THIS SEQUENCE, .HasTitle AND .ChartTitle.Caption GENERATE 1004'S, BUT
THE .ChartType AND .PlotBy PROPERTIES WORK JUST FINE.
I tried adding chFuel.Activate and received a 1004 for my trouble; so I
tried wsChartFuel.Activate (the sheet) and
wsChartFuel.ChartObjects(1).Activate (and the equivalent coFuel.Activate),
all of which work perfectly well, but still don't let me set any of the
problematic chart properties.
Being able to set some properties of the "chart" and getting a runtime error
when trying to set others is really most annoying. In fact, I cannot even
modify these properties in the debug "watches" window (I get 1004 there too).
Any help would be greatly appreciated.
Joseph A. J. Felcon
I am getting a run-time 1004 error when trying to program properties for a
chart. Actually, it is the second chart which I create which is invoking
the error message.
I am creating multiple worksheets, each with one chart. The first worksheet
and chart work fine, but the second and third worksheet/chart cause 1004
errors on certain property values...
' create a new worksheet for chart flow
Application.DisplayAlerts = False
Set wsChartFlow = Worksheets.Add
wsChartFlow.Name = "Chart Flow"
' create the chart flow object
Set coFlow = wsChartFlow.ChartObjects.Add(0, 0, 800, 600)
coFlow.Name = "Net Flow over Time"
Set chFlow = coFlow.Chart
Application.DisplayAlerts = True
' add data to chart for Flow
chFlow.HasTitle = True
chFlow.ChartTitle.Caption = "Net Flow over Time"
chFlow.ChartType = xlXYScatterLines
chFlow.PlotBy = xlColumns
.... HEREIN I ADD SERIES AND GENERALLY FORMAT THE CHART TO MY LIKING ...
.... I ORIGINALLY TRIED ...
' create a new worksheet for chart fuel
Application.DisplayAlerts = False
Set wsChartFuel = Worksheets.Add
wsChartFuel.Name = "Chart Usage"
' create the chart fuel object
Set coFuel = wsChartFuel.ChartObjects.Add(0, 0, 5 * iCopy * m_iSelected,
600)
coFuel.Name = "Fuel Use over Time"
Set chFuel = coFuel.Chart
Application.DisplayAlerts = True
' add data to chart for Fuel
chFuel.HasTitle = True
chFuel.ChartTitle.Caption = "Fuel Use over Time"
chFuel.ChartType = xlColumnClustered
chFuel.PlotBy = xlColumns
.... IN THIS SEQUENCE, .HasTitle AND .ChartTitle.Caption GENERATE 1004'S, BUT
THE .ChartType AND .PlotBy PROPERTIES WORK JUST FINE.
I tried adding chFuel.Activate and received a 1004 for my trouble; so I
tried wsChartFuel.Activate (the sheet) and
wsChartFuel.ChartObjects(1).Activate (and the equivalent coFuel.Activate),
all of which work perfectly well, but still don't let me set any of the
problematic chart properties.
Being able to set some properties of the "chart" and getting a runtime error
when trying to set others is really most annoying. In fact, I cannot even
modify these properties in the debug "watches" window (I get 1004 there too).
Any help would be greatly appreciated.
Joseph A. J. Felcon