Foreground fill color NOT respecting specified RGB

Started by xgrove, January 21, 2015, 04:51:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xgrove

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.

Yacine

#1
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.
Yacine

xgrove

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

Yacine

Next hypothesis:
Are the shapes groups?
When you modify a property of the group by code, the modification does not propagate to its children.
Yacine

xgrove

< 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

Yacine

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. ;)
Yacine

wapperdude

Change your syntax
  from: TOCEntry.Cells("FillForegnd") = RGB(195, 215, 232)
  to:  TOCEntry.Cells("FillForegnd").FormulaU = "RGB(195, 215, 232)"

Should work.

Wapperdude
Visio 2019 Pro

Yacine

Yacine

xgrove

wapperdude ... you're the DUDE!

Thank you. I will abide today.

wapperdude

Just a 2nd pair of eyes.   Was still expecting a problem associated with group shapes per Yacine.  Sometimes being lucky works!   ;D
Visio 2019 Pro