Shape color does not change when changing FillForegnd

Started by gold78, October 28, 2019, 02:31:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gold78

Hello,

I am new to Visio and I am facing an annoying issue.

I have the following code that changes the value of FillForegnd successfully (when viewed in the ShapeSheet).

The problem is that it does not change on the screen itself.

My project is an Org Chart, where I'd like to change certain shapes' color. So in fact the shape is a group.
My loop is going through all shapes (avoiding the lines by checking the Prop.Name presence).


For Each vsoshape In vsoPage.Shapes
        If vsoshape.CellExists("Prop.Name", False) Then

                 Set cell = vsoshape.Cells("FillForegnd")
                 cell.FormulaU = "RGB(255, 0, 0)"

        End If
Next


thank you and regards,


wapperdude

Syntax error, was:

Set cell = vsoshape.Cells("FillForegnd")
                 cell.FormulaU = "RGB(255, 0, 0)"

becomes:
vsoshape.Cells("FillForegnd").FormulaU = "RGB(255, 0, 0)"

Note, however, in this context, VBA sets the group color specifically, and the value does not pass down to the subshapes.  You have to additional checking for subshapes, and then change their fill.  See http://www.visguy.com/2008/05/17/detect-sub-selected-shapes-programmatically/

Visio 2019 Pro