Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
chart works in excel 2007, not 2003
The following code works fine in 2007. In 2003, I get error "1004 -
Unable to set the XValue property of the Series class" on the line with the asterisk (*). If I move the line " chartpoint.ChartType = xlLineMarkers" to after the line with the asterisk, it works fine until it gets to the next line. I have been rearranging lines, but have not found any arrangement that works with 2003. Any ideas? newchart.Chart.SetSourceData Source:=.Range(.Cells(irow + 1, 1), .Cells(irow + 4, 61)) _ , PlotBy:=xlRows Set chartpoint = newchart.Chart chartpoint.HasLegend = False chartpoint.HasDataTable = True chartpoint.DataTable.ShowLegendKey = True chartpoint.ChartType = xlLineMarkers chartpoint.HasTitle = True chartpoint.ChartTitle.Text = tpms(itask, itpm) chartpoint.Axes(xlCategory, xlPrimary).HasTitle = False chartpoint.Axes(xlValue, xlPrimary).HasTitle = True chartpoint.Axes(xlValue).AxisTitle.Text = units(itask, itpm) * chartpoint.SeriesCollection(1).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(1).Format.Line.Visible = False chartpoint.SeriesCollection(1).Border.LineStyle = xlNone chartpoint.SeriesCollection(1).MarkerBackgroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerForegroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerStyle = xlDiamond chartpoint.SeriesCollection(1).Smooth = False chartpoint.SeriesCollection(1).MarkerSize = 5 chartpoint.SeriesCollection(1).Shadow = False chartpoint.SeriesCollection(2).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(2).Format.Line.Visible = False chartpoint.SeriesCollection(2).Border.LineStyle = xlNone chartpoint.SeriesCollection(2).MarkerBackgroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerForegroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerStyle = xlSquare chartpoint.SeriesCollection(2).Smooth = False chartpoint.SeriesCollection(2).MarkerSize = 5 chartpoint.SeriesCollection(2).Shadow = False chartpoint.SeriesCollection(3).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(3).Border.ColorIndex = 4 chartpoint.SeriesCollection(3).Border.Weight = xlThick chartpoint.SeriesCollection(3).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(3).MarkerStyle = xlNone chartpoint.SeriesCollection(3).Smooth = False chartpoint.SeriesCollection(3).Shadow = False chartpoint.SeriesCollection(4).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(4).Border.ColorIndex = 6 chartpoint.SeriesCollection(4).Border.Weight = xlThick chartpoint.SeriesCollection(4).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(4).MarkerStyle = xlNone chartpoint.SeriesCollection(4).Smooth = False chartpoint.SeriesCollection(4).MarkerSize = 5 chartpoint.SeriesCollection(4).Shadow = False chartpoint.PlotArea.Interior.Color = vbWhite chartpoint.PlotArea.Border.ColorIndex = 2 chartpoint.PlotArea.Border.Weight = xlThin chartpoint.PlotArea.Border.LineStyle = xlContinuous |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
chart works in excel 2007, not 2003
I'm guessing that you need to create a new series before you XValues line
with something like this: chartpoint.SeriesCollection.NewSeries Let me know if it works. HTH, Barb Reinhardt " wrote: The following code works fine in 2007. In 2003, I get error "1004 - Unable to set the XValue property of the Series class" on the line with the asterisk (*). If I move the line " chartpoint.ChartType = xlLineMarkers" to after the line with the asterisk, it works fine until it gets to the next line. I have been rearranging lines, but have not found any arrangement that works with 2003. Any ideas? newchart.Chart.SetSourceData Source:=.Range(.Cells(irow + 1, 1), .Cells(irow + 4, 61)) _ , PlotBy:=xlRows Set chartpoint = newchart.Chart chartpoint.HasLegend = False chartpoint.HasDataTable = True chartpoint.DataTable.ShowLegendKey = True chartpoint.ChartType = xlLineMarkers chartpoint.HasTitle = True chartpoint.ChartTitle.Text = tpms(itask, itpm) chartpoint.Axes(xlCategory, xlPrimary).HasTitle = False chartpoint.Axes(xlValue, xlPrimary).HasTitle = True chartpoint.Axes(xlValue).AxisTitle.Text = units(itask, itpm) * chartpoint.SeriesCollection(1).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(1).Format.Line.Visible = False chartpoint.SeriesCollection(1).Border.LineStyle = xlNone chartpoint.SeriesCollection(1).MarkerBackgroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerForegroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerStyle = xlDiamond chartpoint.SeriesCollection(1).Smooth = False chartpoint.SeriesCollection(1).MarkerSize = 5 chartpoint.SeriesCollection(1).Shadow = False chartpoint.SeriesCollection(2).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(2).Format.Line.Visible = False chartpoint.SeriesCollection(2).Border.LineStyle = xlNone chartpoint.SeriesCollection(2).MarkerBackgroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerForegroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerStyle = xlSquare chartpoint.SeriesCollection(2).Smooth = False chartpoint.SeriesCollection(2).MarkerSize = 5 chartpoint.SeriesCollection(2).Shadow = False chartpoint.SeriesCollection(3).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(3).Border.ColorIndex = 4 chartpoint.SeriesCollection(3).Border.Weight = xlThick chartpoint.SeriesCollection(3).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(3).MarkerStyle = xlNone chartpoint.SeriesCollection(3).Smooth = False chartpoint.SeriesCollection(3).Shadow = False chartpoint.SeriesCollection(4).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(4).Border.ColorIndex = 6 chartpoint.SeriesCollection(4).Border.Weight = xlThick chartpoint.SeriesCollection(4).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(4).MarkerStyle = xlNone chartpoint.SeriesCollection(4).Smooth = False chartpoint.SeriesCollection(4).MarkerSize = 5 chartpoint.SeriesCollection(4).Shadow = False chartpoint.PlotArea.Interior.Color = vbWhite chartpoint.PlotArea.Border.ColorIndex = 2 chartpoint.PlotArea.Border.Weight = xlThin chartpoint.PlotArea.Border.LineStyle = xlContinuous |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
chart works in excel 2007, not 2003
In general, despite the output of the macro recorder, VBA works more
reliably if you don't specify the ChartType until after the chart is populated with data. Also, you have better control if you dispense with SetSourceData, and instead delete any series in the newly created chart, then use .NewSeries and .Values and .XValues to create and populate each series. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ wrote in message ups.com... The following code works fine in 2007. In 2003, I get error "1004 - Unable to set the XValue property of the Series class" on the line with the asterisk (*). If I move the line " chartpoint.ChartType = xlLineMarkers" to after the line with the asterisk, it works fine until it gets to the next line. I have been rearranging lines, but have not found any arrangement that works with 2003. Any ideas? newchart.Chart.SetSourceData Source:=.Range(.Cells(irow + 1, 1), .Cells(irow + 4, 61)) _ , PlotBy:=xlRows Set chartpoint = newchart.Chart chartpoint.HasLegend = False chartpoint.HasDataTable = True chartpoint.DataTable.ShowLegendKey = True chartpoint.ChartType = xlLineMarkers chartpoint.HasTitle = True chartpoint.ChartTitle.Text = tpms(itask, itpm) chartpoint.Axes(xlCategory, xlPrimary).HasTitle = False chartpoint.Axes(xlValue, xlPrimary).HasTitle = True chartpoint.Axes(xlValue).AxisTitle.Text = units(itask, itpm) * chartpoint.SeriesCollection(1).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(1).Format.Line.Visible = False chartpoint.SeriesCollection(1).Border.LineStyle = xlNone chartpoint.SeriesCollection(1).MarkerBackgroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerForegroundCol orIndex = 3 chartpoint.SeriesCollection(1).MarkerStyle = xlDiamond chartpoint.SeriesCollection(1).Smooth = False chartpoint.SeriesCollection(1).MarkerSize = 5 chartpoint.SeriesCollection(1).Shadow = False chartpoint.SeriesCollection(2).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(2).Format.Line.Visible = False chartpoint.SeriesCollection(2).Border.LineStyle = xlNone chartpoint.SeriesCollection(2).MarkerBackgroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerForegroundCol orIndex = 5 chartpoint.SeriesCollection(2).MarkerStyle = xlSquare chartpoint.SeriesCollection(2).Smooth = False chartpoint.SeriesCollection(2).MarkerSize = 5 chartpoint.SeriesCollection(2).Shadow = False chartpoint.SeriesCollection(3).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(3).Border.ColorIndex = 4 chartpoint.SeriesCollection(3).Border.Weight = xlThick chartpoint.SeriesCollection(3).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(3).MarkerStyle = xlNone chartpoint.SeriesCollection(3).Smooth = False chartpoint.SeriesCollection(3).Shadow = False chartpoint.SeriesCollection(4).XValues = .Range("b6:bi6") chartpoint.SeriesCollection(4).Border.ColorIndex = 6 chartpoint.SeriesCollection(4).Border.Weight = xlThick chartpoint.SeriesCollection(4).Border.LineStyle = xlContinuous chartpoint.SeriesCollection(4).MarkerStyle = xlNone chartpoint.SeriesCollection(4).Smooth = False chartpoint.SeriesCollection(4).MarkerSize = 5 chartpoint.SeriesCollection(4).Shadow = False chartpoint.PlotArea.Interior.Color = vbWhite chartpoint.PlotArea.Border.ColorIndex = 2 chartpoint.PlotArea.Border.Weight = xlThin chartpoint.PlotArea.Border.LineStyle = xlContinuous |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SUMIF formula works in Excel 2003, does not work in Excel 2007 | Excel Discussion (Misc queries) | |||
function =IFERROR LOOKUP works in excel 2007 not in excel 2003 | Excel Worksheet Functions | |||
Works in 2007 but not 2003 | Excel Discussion (Misc queries) | |||
xls file works fine in Excel 2000 and 2007 but crashes on opening in 2003 | Excel Discussion (Misc queries) | |||
sortTable works in 2003 but not in 2007 | Excel Programming |