PC Review


Reply
Thread Tools Rate Thread

chart works in excel 2007, not 2003

 
 
satlow@draper.com
Guest
Posts: n/a
 
      24th Aug 2007
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).MarkerBackgroundColorIndex = 3
chartpoint.SeriesCollection(1).MarkerForegroundColorIndex = 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).MarkerBackgroundColorIndex = 5
chartpoint.SeriesCollection(2).MarkerForegroundColorIndex = 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 With Quote
 
 
 
 
=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
Guest
Posts: n/a
 
      24th Aug 2007
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

"(E-Mail Removed)" 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).MarkerBackgroundColorIndex = 3
> chartpoint.SeriesCollection(1).MarkerForegroundColorIndex = 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).MarkerBackgroundColorIndex = 5
> chartpoint.SeriesCollection(2).MarkerForegroundColorIndex = 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 With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      27th Aug 2007
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
_______


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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).MarkerBackgroundColorIndex = 3
> chartpoint.SeriesCollection(1).MarkerForegroundColorIndex = 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).MarkerBackgroundColorIndex = 5
> chartpoint.SeriesCollection(2).MarkerForegroundColorIndex = 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 VB referencing #N/A not working but works in Excel 2007 KMH Microsoft Excel Programming 1 9th Mar 2010 05:26 PM
SUMIF formula works in Excel 2003, does not work in Excel 2007 Harry Microsoft Excel Misc 3 24th Apr 2009 02:33 PM
function =IFERROR LOOKUP works in excel 2007 not in excel 2003 David Ryan Microsoft Excel Worksheet Functions 4 15th Apr 2009 03:25 PM
Automation C++ code works for Excel 2003, not for Excel 2007 jayo Microsoft Excel Programming 0 6th Aug 2008 06:51 PM
Automation works with Excel 2003 but NOT Excel 2007 =?Utf-8?B?U0JpbG8=?= Microsoft Excel Programming 5 30th Aug 2007 08:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:44 PM.