Visio Guy

Visio Discussions => Programming & Code => Topic started by: kebo on May 12, 2008, 06:50:53 PM

Title: Get a shapes RGB color ?
Post by: kebo on May 12, 2008, 06:50:53 PM
I'm using the following code to get fill color of a shape...

s = shp.CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU

this returns the value of "THEMEGUARD(TINT(THEME("AccentColor4"),24))" which seems greek to me. In the shape sheet I can clearly see the "RGB(113,65,83)" until I click the cell to edit the value. When I do click it the RGB value goes away and I can edit the value that is returned from the shp.CellsSRC method.

How do I get the RGB values of a shape?
thanks
kevin
Title: Re: Get a shapes RGB color ?
Post by: Visio Guy on May 12, 2008, 08:21:37 PM
Hi Kevin,

ShapeSheet cells have values and formulas.

Try this:

   .Result(Visio.visUnitCodes.visNoCast)

instead of .Formula...
Title: Re: Get a shapes RGB color ?
Post by: kebo on May 12, 2008, 09:07:37 PM
Thanks visio guy...

ok... so THEMEGUARD(TINT(THEME("AccentColor4"),24)) is a formula and the RGB color should be the value ?

When I tried using .Result(visNoCast) I get "41" which doesn't seem to be correct.
kevin
Title: Re: Get a shapes RGB color ?
Post by: Visio Guy on May 12, 2008, 09:35:46 PM
Yeah, but sometimes the colors get mapped to one of the indexed colors - like 0 is black and 1 is white. I haven't totally figured out what they're doing yet. The Themes stuff has made it even more complicated.

I just tried this and it works:

   ...Cells("FillForegnd").ResultStr(visNoCast)

gives you:

   RGB(113, 191, 210)

Curiously, there's a constant for Visio.visUnitCodes.visUnitsColor, but that returned the index too.
Title: Re: Get a shapes RGB color ?
Post by: kebo on May 12, 2008, 09:50:30 PM
thanks again....

the ResultStr is what I was looking for.... I should have just looked and tried it.
kevin