Search code examples
vbapowerpointvisibleoffice-2010

Is it possible to use VBA to hide/show a text box on a Custom Layout in a PowerPoint 2010?


Is it possible to use VBA to hide/show a text box on a Custom Layout in a PowerPoint 2010? I would like to hide/show a specific text box that is on the custom layout of each slide at the click of a button and am not sure of the best way to go about doing that.

Any help, much appreciated.


Solution

  • Suppose you have a shape named Rectangle 6 on the third layout of the first slide master.

    Sub Example()
    Dim oSh As Shape
    
    ' Get a reference to the shape
    Set oSh = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(3).Shapes("Rectangle 6")
    
    ' Set its visible property to false
    oSh.Visible = False
    
    End Sub