I am an experienced VBA programmer but have only just begun using VBA in Powerpoint 2010. I am trying to set write code to a) set two shape object variables to particular shapes on the slide, b) check the value of a checkbox and c) to show or hide the two shapes depending on the value of the checkbox.
I have named the two shapes "ProspectText" and "ProspectCallout" and the checkbox (ProspectCheck).
My initial code (below) to set the shape objects is generating an error that says something like "Item "ProspectText" not found in shapes collection."
Dim oText As Shape
Dim oCallout As Shape
Dim oCheck As Boolean
Set oText = ActivePresentation.Slides(2).Shapes("ProspectText")
Set oCallout = ActivePresentation.Slides(2).Shapes("ProspectCallout")
oCheck = ActivePresentation.Slides(2).Shapes("ProspectCheck")
If oCheck = True Then
ShowShapes oText, oCallout
HideShapes oText, oCallout
I have checked in the Selection and Visibility pane and through code to ensure the names are correct.
Does anyone have any ideas on what to try?