Visio Guy

Visio Discussions => Visio Bugs (er...Issues) => Topic started by: xgrove on January 21, 2015, 04:51:32 PM

Title: Foreground fill color NOT respecting specified RGB
Post by: xgrove on January 21, 2015, 04:51:32 PM
I've created a table of contents module that alternates the colors of the "buttons". Unfortunately the resulting colors are waaaay off. For instance RGB(224, 230, 205) becomes RGB(255,60,60). I see that when I right click on  a "button" and go to "Show ShapeSheet". I can manually change the value there and it works.

            ' Alternate the foreground color
            If (loopCount Mod 2 = 0) Then
                TOCEntry.Cells("FillForegnd") = RGB(195, 215, 232)
            Else
                TOCEntry.Cells("FillForegnd") = RGB(224, 230, 205)
            End If

Thanks.
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: Yacine on January 21, 2015, 05:48:09 PM
1)
I see that the patterns repeat after 4 rows. Aren't there 4 possibilities?
--> select case loopcount Mod 4
case 0:
case 1:
case 2:
case 3:
end select

2) Is there any "error resume next" hiding that a shape's colour is protected?

3) Are you sure about the order of the shapes.
Try modifying an additional property, to check that the right shape is modified.
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: xgrove on January 21, 2015, 06:12:31 PM
Hi Yacine.

The image I attached was a mashup to show the colors that ARE displayed and the ones that SHOULD have been displayed. The process to generate the clickable "button" works fine; it's the passed in color value that is messed up.

I'll attach a snap of the result.

Richard
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: Yacine on January 21, 2015, 06:40:00 PM
Next hypothesis:
Are the shapes groups?
When you modify a property of the group by code, the modification does not propagate to its children.
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: xgrove on January 21, 2015, 06:50:02 PM
< Are the shapes groups? >
I cannot categorically say that they are NOT a group as they appear to be independent shapes.

Set TOCEntry = ActiveDocument.Pages(1).DrawRectangle(4.6, PosY, 4, PosY + 0.5)

Sidebar question: Since setting the color via RGB seems not to work, how can I specify a user defined color? As I was fooling around with this I noticed that I could assign each shape a number (highlighted below).

Question: Is there a table of these colors?

            If (loopCount Mod 2 = 0) Then
                TOCEntry.Cells("FillForegnd") = RGB(195, 215, 232)
                ' TOCEntry.Cells("FillForegnd") = 169
            Else
                TOCEntry.Cells("FillForegnd") = RGB(224, 230, 205)
                ' TOCEntry.Cells("FillForegnd") = 4
            End If
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: Yacine on January 21, 2015, 07:03:53 PM
QuoteAre the shapes groups?I cannot categorically say that they are NOT a group as they appear to be independent shapes.

View/Drawing Explorer Window allows you to display the drawing explorer.
It will show you a tree view of the document, with pages, shapes, etc.
If a shape displays a "+" in front of it, it is a group.
In this case the code needs to iterate through the sub-shapes.
Something like:
for each subShape in shp.Shapes
  set color
next subShape


Colours table:
Not sure about this, but I think to recall that shape coloúr (integer) values are document dependent. Thus no list possible, but Google is your friend. ;)
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: wapperdude on January 21, 2015, 08:18:41 PM
Change your syntax
  from: TOCEntry.Cells("FillForegnd") = RGB(195, 215, 232)
  to:  TOCEntry.Cells("FillForegnd").FormulaU = "RGB(195, 215, 232)"

Should work.

Wapperdude
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: Yacine on January 21, 2015, 08:35:56 PM
How embarrassing! Of Course!
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: xgrove on January 21, 2015, 08:42:18 PM
wapperdude ... you're the DUDE!

Thank you. I will abide today.
Title: Re: Foreground fill color NOT respecting specified RGB
Post by: wapperdude on January 21, 2015, 08:52:55 PM
Just a 2nd pair of eyes.   Was still expecting a problem associated with group shapes per Yacine.  Sometimes being lucky works!   ;D