Author Topic: Get a shapes RGB color ?  (Read 7110 times)

0 Members and 1 Guest are viewing this topic.

kebo

  • Newbie
  • *
  • Posts: 7
Get a shapes RGB color ?
« on: May 12, 2008, 01:50:53 PM »
I'm using the following code to get fill color of a shape...

Code
 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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1723
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Get a shapes RGB color ?
« Reply #1 on: May 12, 2008, 03:21:37 PM »
Hi Kevin,

ShapeSheet cells have values and formulas.

Try this:

   .Result(Visio.visUnitCodes.visNoCast)

instead of .Formula...
« Last Edit: May 13, 2008, 02:45:54 PM by Visio Guy »
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

  • Newbie
  • *
  • Posts: 7
Re: Get a shapes RGB color ?
« Reply #2 on: May 12, 2008, 04: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

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1723
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Get a shapes RGB color ?
« Reply #3 on: May 12, 2008, 04: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.
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

  • Newbie
  • *
  • Posts: 7
Re: Get a shapes RGB color ?
« Reply #4 on: May 12, 2008, 04:50:30 PM »
thanks again....

the ResultStr is what I was looking for.... I should have just looked and tried it.
kevin
« Last Edit: May 13, 2008, 12:43:52 AM by Visio Guy »