Color of a linechart

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
 
G

Gary Klass

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
 
H

Henning Winkler

Hi Gary,

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

Thanks!

Henning
 
J

Jon Peltier

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top