I'm trying to simulate a "magic wand" effect on shapes in PowerPoint. I want my macro to select any shape on the current slide that matches the currently selected shape's fill color.
Here's my code:
[vba]
'Fill Color
If cb_FillColor = True Then
myFillColor = ActiveWindow.Selection.ShapeRange.Fill.ForeColor.RGB
For Each shp In ActivePresentation.Slides(mySlide).Shapes.Range
If shp.Fill.ForeColor.RGB = myFillColor Then
shp.Select
End If
Next
End If
[/vba]
However, it's not making the selection add to itself. It's just looping through the shapes one by one and ending on the last one that matches the criteria. Is there a way to ADD to a selection as I loop through the shapes?
FYI: cb_FillColor is the checkbox name on a form I'm using.