Color of a linechart

  • Thread starter Thread starter Henning Winkler
  • Start date Start date
H

Henning Winkler

Hi,

I want to change the color of a line in a linechart (Excel97) by VB6.

There a 3 lines (I can see my control message
..Chart.Seriescollection.Count = 3 -> OK!)

But if I change the color by

..Chart.SeriesCollection(1).Border.ColorIndex = 3
or
..Chart.SeriesCollection(1).Border.Color = RGB(255,0,0)

an error occured:

"The property ColorIndex cannot be changed!" or something like that.

Can anybody tell me what's wrong.

Thanks

Henning
 
Does this not work?

ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 3


Henning said:
Hi,

I want to change the color of a line in a linechart (Excel97) by VB6.

There a 3 lines (I can see my control message
.Chart.Seriescollection.Count = 3 -> OK!)

But if I change the color by

.Chart.SeriesCollection(1).Border.ColorIndex = 3
or
.Chart.SeriesCollection(1).Border.Color = RGB(255,0,0)

an error occured:

"The property ColorIndex cannot be changed!" or something like that.

Can anybody tell me what's wrong.

Thanks

Henning

--
Gary Klass
(e-mail address removed)
Editor, PSRT-L
4600 Politics and Government
Illinois State University
Normal, Illinois 61790
http://LILT.ILSTU.EDU/gmklass
(309) 438-7852
(fax) 438-7638
The Chart of the Week: http://LILT.ILSTU.EDU/gmklass/cow
 
Hi Gary,

that was it ! I forgot the "select"-clause ! Now it works fine!

Thanks!

Henning
 
Henning -

You shouldn't have to select the series to format its border. I wonder
if you are improperly referencing the series. If the chart is selected,
this works (I just checked):

ActiveChart.SeriesCollection(1).Border.ColorIndex = 3

If the chart is not selected, but its parent worksheet is, this works
(also tried and true):

ActiveSheet.ChartObjects(2).Chart.SeriesCollection(1).Border _
.ColorIndex = 3

- Jon
 
Back
Top