Get a shapes RGB color ?

Started by kebo, May 12, 2008, 06:50:53 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

kebo

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

Visio Guy

#1
Hi Kevin,

ShapeSheet cells have values and formulas.

Try this:

   .Result(Visio.visUnitCodes.visNoCast)

instead of .Formula...
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

kebo

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

Visio Guy

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.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

kebo

#4
thanks again....

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