PDA

View Full Version : Powerpoint VBA Button Hover Effect for shape within a group



kenny_a
08-08-2022, 09:42 PM
I'm trying to set up a button hover effect using code from this article:
https://www.brightcarbon.com/blog/supercharging-powerpoint-interactive-presentations-with-vba-part-2/


On the button shape I use this for the hover:




Public Sub GraphicHover(ByRef oGraphic As Shape)
oGraphic.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent1
End Sub


And to reset it I use this on a shape covering the rest of the slide:





Public Sub ResetGraphicHover(ByRef oCover As Shape)
Dim oSld As Slide
Dim oShp As Shape
Set oSld = oCover.Parent
For Each oShp In oSld.Shapes
With oShp.Fill.ForeColor
If .ObjectThemeColor = msoThemeColorAccent1 Then .ObjectThemeColor = msoThemeColorDark1
End With
Next
End Sub



I have it working, however I now want to group my button shape. When I group it the hover works, but not the reset.
Is there an easy way to adjust the code to work with grouped shapes?


Thanks