Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 192
Default change series or line color in excel 2007 vba

I've done this hundreds of times in 2003, but in 2007 I'm hitting some snags.
I think it has to do with the chart styles found in excel 2007. I'm trying
to change the color of a series in my line graph using the following code:

Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)

objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

But, this isn't working at all. Nothing is happening to the line. I'm able
to do other things to the series, such as change the marker style, the marker
color, the line style, but not the line color.

Any ideas???
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default change series or line color in excel 2007 vba

This works:

objSeries.Border.Color = RGB(255, 127, 0)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Nick" wrote in message
...
I've done this hundreds of times in 2003, but in 2007 I'm hitting some
snags.
I think it has to do with the chart styles found in excel 2007. I'm
trying
to change the color of a series in my line graph using the following code:

Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)

objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

But, this isn't working at all. Nothing is happening to the line. I'm
able
to do other things to the series, such as change the marker style, the
marker
color, the line style, but not the line color.

Any ideas???



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 192
Default change series or line color in excel 2007 vba

Thanks!! That worked. One more question. Do you happen to know why the
border object does not show up when using intellisense in the VBA window of
Excel 2007? That makes it seem as though the border object has been removed
from the 2007 object model.

"Jon Peltier" wrote:

This works:

objSeries.Border.Color = RGB(255, 127, 0)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Nick" wrote in message
...
I've done this hundreds of times in 2003, but in 2007 I'm hitting some
snags.
I think it has to do with the chart styles found in excel 2007. I'm
trying
to change the color of a series in my line graph using the following code:

Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)

objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

But, this isn't working at all. Nothing is happening to the line. I'm
able
to do other things to the series, such as change the marker style, the
marker
color, the line style, but not the line color.

Any ideas???




  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default change series or line color in excel 2007 vba

Hi,

In VBE press F2 to display object browser. Right click and pick Show
Hidden Members. Border is now there.

Also did you notice how Jon's suggested work around then makes your line
of code work! If you step through the code you should see the line go
black and then Orange, or what ever your colour is.

objSeries.Border.Color = RGB(0, 0, 0)
objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

Cheers
Andy

Nick wrote:
Thanks!! That worked. One more question. Do you happen to know why the
border object does not show up when using intellisense in the VBA window of
Excel 2007? That makes it seem as though the border object has been removed
from the 2007 object model.

"Jon Peltier" wrote:


This works:

objSeries.Border.Color = RGB(255, 127, 0)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Nick" wrote in message
...

I've done this hundreds of times in 2003, but in 2007 I'm hitting some
snags.
I think it has to do with the chart styles found in excel 2007. I'm
trying
to change the color of a series in my line graph using the following code:

Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)

objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

But, this isn't working at all. Nothing is happening to the line. I'm
able
to do other things to the series, such as change the marker style, the
marker
color, the line style, but not the line color.

Any ideas???





--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 447
Default change series or line color in excel 2007 vba

Hello Nick,

I am new to using Macros in Excel and am trying to set the colour of a
marker depending on its value. For example: if the value in the table is less
than 4 the colour is red, if between 4 and 7 it should be yellow and if
between 7 and 10 the value is green.
Have you assigned colours to markers based on this type of criteria?
Would you have a sample piece of code that could help me out?

Thanks,

Karen

"Nick" wrote:

I've done this hundreds of times in 2003, but in 2007 I'm hitting some snags.
I think it has to do with the chart styles found in excel 2007. I'm trying
to change the color of a series in my line graph using the following code:

Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)

objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

But, this isn't working at all. Nothing is happening to the line. I'm able
to do other things to the series, such as change the marker style, the marker
color, the line style, but not the line color.

Any ideas???

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
How to change the color of all series in an excel chart in one go. Marielle Charts and Charting in Excel 2 May 3rd 23 07:45 PM
excel 2007 - change fill color from one color to another okiedokiedoo Excel Discussion (Misc queries) 1 December 30th 07 10:25 PM
how do I change a line series to a column series in excel? Mati Charts and Charting in Excel 1 May 12th 05 09:32 AM
change series color in Excel VB [email protected] Charts and Charting in Excel 0 March 1st 05 06:33 AM
How to change the color of all series in an excel chart in one go. Mz2 Charts and Charting in Excel 1 January 20th 05 01:07 AM


All times are GMT +1. The time now is 10:02 AM.

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"