I would like to select the objects by the color.
So far I did something like this:
If Vshp.CellsU("FillForegnd").FormulaU = "RGB(128,128,128)" Then
sel.Select Vshp, visSelect
End If
But I see no reaction at all.
I picked it from here:
Visio change color of all child elements using VBA
and here:
VBA Change the Color of a Rounded Rectangle in Visio
Is there any way of how I could pick up the shapes by their exact RGB colour?
UPDATE:
With the following approach:
If Vshp.Shapes(4).CellsU("FillForegnd").FormulaU = "RGB(128,128,128)"
Then
sel.Select Vshp, visSelect
End If
I receive the following error:
Invalid Sheet identifier
Pointing out the line: If Vshp.Shapes(4).CellsU("FillForegnd").FormulaU = "RGB(128,128,128)"
The following threads: "Shape.ConnectedShapes method (Visio)" example from Microsoft site give "Invalid Sheet Identifier" error http://visguy.com/vgforum/index.php?topic=9713.0 Weren't helpful for me
UPDATE II:
I realized, that the subshape cannot be .Shape(4)
, because it's the text.
I just need to know how to read the Drawing explorer window, because I see multiple of the same shapes in my layer and I have no clue which one should correspond to the Cabinet(Fibre Schematic).2125
, or alternatively could I pick them up by name?.
UPDATE III
After searching the solution I found a nice hint here:
http://visguy.com/vgforum/index.php?topic=7577.0
but unfortunately it doesn't work with the manner I would like to apply:
The current code:
For Each subshp In vShp.Shapes
If subshp.CellsU("FillForeground").FormulaU = "RGB(128,128,128)" Then
ActiveWindow.Select subshp, visSubSelect
End If
Next subshp
Throws the error:
Unexpected end of file
At the line:
If subshp.CellsU("FillForeground").FormulaU = "RGB(128,128,128)" Then