microsoft graph color palette

G

Guest

I am fairly new to VBA and would like to create a macro
which can change the complete color palette (except for
the default PPT colors) of a MS Graph object in
PowerPoint.
I hope someone can help me, or otherwise I am looking for
documentation on how to create code for MS Graph
Thanks in advance
Ingrid
 
S

Steve Rindsberg

I am fairly new to VBA and would like to create a macro
which can change the complete color palette (except for
the default PPT colors) of a MS Graph object in
PowerPoint.

Graph doesn't allow you to customize its color palette.


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
G

Guest

-----Original Message-----
Graph doesn't allow you to customize its color palette.


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

.
Although I hoped it was possible, Thank you very much
for your prompt reply!
Ingrid
 
G

Guest

-----Original Message-----
Graph doesn't allow you to customize its color palette.


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

.
But this is what I found in the MSDN library, this morning
(but it doesn't work)

**********************************************************
Colors Property
See Also Applies To Example
Returns or sets colors in the palette for a Chart object.
The palette has 56 entries, each represented by an RGB
value. Read/write Variant.

expression.Colors(Index)

expression Required. An expression that returns one of
the objects in the Applies To list.

Index Optional Variant. The color number (from 1 to 56).
If this argument isnt specified, this method returns an
array that contains all 56 of the colors in the palette.

Example
This example sets color five in the color palette for the
active chart.

ActiveChart.Colors(5) = RGB(255, 0, 0)
*********************************************
 
S

Steve Rindsberg

But this is what I found in the MSDN library, this morning
(but it doesn't work)

Are you certain the code is intended for MSGraph and not Excel Charts?
Excel does let you change the colors.
The code probably doesn't provoke any errors in MSGraph but MSGraph probably
maps the color you request to the closest indexed color from the existing
palette and uses that instead.

**********************************************************
Colors Property
See Also Applies To Example
Returns or sets colors in the palette for a Chart object.
The palette has 56 entries, each represented by an RGB
value. Read/write Variant.

expression.Colors(Index)

expression Required. An expression that returns one of
the objects in the Applies To list.

Index Optional Variant. The color number (from 1 to 56).
If this argument isnt specified, this method returns an
array that contains all 56 of the colors in the palette.

Example
This example sets color five in the color palette for the
active chart.

ActiveChart.Colors(5) = RGB(255, 0, 0)
*********************************************

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
G

Guest

Unfortunately I cannot enclose a snapshot, but as far as I
can see, this code was written for Microsoft Graph. I
found it in the MSDN library under:
Office Solutions Development - Microsoft Office - VBA
language reference -Microsoft Graph Object Model -
Properties - C
It seems that VBA does not recognize RGB values, because
it does not allow me to change colors of series to an RGB
value within a chart either.
This is what I tried (And this code can also be looked up
in several sources VBA Graph Help, MSDN library) :

Sub changeseriecolor()
Set myChart = ActiveWindow.Selection.ShapeRange(1) _
..OLEFormat.Object.Application.chart
myChart.SeriesCollection(2).Interior.Color _
= RGB(Red:=2, Green:=110, Blue:=6)
End Sub

And indeed then the color will be replaced by an index
color. It is very confusing I think when both the Help
file and MSDN library gives this code and it does not work.
 
S

Steve Rindsberg

It seems that VBA does not recognize RGB values, because
it does not allow me to change colors of series to an RGB
value within a chart either.
This is what I tried (And this code can also be looked up
in several sources VBA Graph Help, MSDN library) :

Sub changeseriecolor()
Set myChart = ActiveWindow.Selection.ShapeRange(1) _
..OLEFormat.Object.Application.chart
myChart.SeriesCollection(2).Interior.Color _
= RGB(Red:=2, Green:=110, Blue:=6)
End Sub

And indeed then the color will be replaced by an index
color. It is very confusing I think when both the Help
file and MSDN library gives this code and it does not work.

Yes, it is. That's one of the reasons I trust the advice I get here more than
what appears in Help and MSDN.
 
C

Cindy M -WordMVP-

as far as I
can see, this code was written for Microsoft Graph. I
found it in the MSDN library under:
Office Solutions Development - Microsoft Office - VBA
language reference -Microsoft Graph Object Model -
Properties - C
It seems that VBA does not recognize RGB values, because
it does not allow me to change colors of series to an RGB
value within a chart either.
I agree with Steve's answer :) An additional note, however,
might help explain how the mix-up could occur: MS Graph uses
the same charting engine as MS Excel's chart feature. Except
that
- MS Graph doesn't have Excel to provide things such as
the datasheet and the color schemes
- MS Graph doesn't expose all the same functionality in
the object model

Most likely, whoever is responsible for that article thought
that, since it works in Excel it ought also to work for MS
Graph... (Which doesn't excuse the fact that neither the
author nor the editor responsible for the site ever actually
TESTED the code.)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun
8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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