Myron, Selection Change can get very tricky because you are correct it is very easy to get stuck in a loop. You can use the PreserveSelection to help. Try setting your PreserveSelection = False. Here is my little example. To make it work created two shapes and name one 'Red' and the other 'Black' When you click on the shape 'Red' it finds all the shapes filled with black and fills them red. When you click on the shape 'Black' it finds all the red shapes and fills them black. Private Sub GlobalMacroStorage_SelectionChange() If Not ActiveShape Is Nothing Then If (ActiveShape.Name = "Black" ) Or (ActiveShape.Name = "Red" ) Then Dim sr As ShapeRange ActiveDocument.PreserveSelection = False If ActiveShape.Name = "Black" Then Set sr = ActivePage.Shapes.FindShapes(Query:= "@fill.color.name = 'Red' and @name <> 'Black' and @name <> 'Red'" ) sr.ApplyUniformFill CreateCMYKColor(0, 0, 0, 100) End If If ActiveShape.Name = "Red" Then Set sr = ActivePage.Shapes.FindShapes(Query:= "@fill.color.name = 'Black' and @name <> 'Red' and @name <> 'Black'" ) sr.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0) End If Set sr = Nothing End If End If End Sub Hopefully that helps. -Shelby
↧