Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMIF formula works in Excel 2003, does not work in Excel 2007 Harry Excel Discussion (Misc queries) 3 April 24th 09 02:33 PM
function =IFERROR LOOKUP works in excel 2007 not in excel 2003 David Ryan Excel Worksheet Functions 4 April 15th 09 03:25 PM
Works in 2007 but not 2003 teepee[_3_] Excel Discussion (Misc queries) 9 November 25th 08 08:53 AM
xls file works fine in Excel 2000 and 2007 but crashes on opening in 2003 gromit12 Excel Discussion (Misc queries) 2 November 6th 07 09:30 PM
sortTable works in 2003 but not in 2007 Marcello Excel Programming 4 March 6th 07 12:24 PM


All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"