Remove or Hide PowerPoint Controls on All Slides

ppt3If you customize PowerPoint with controls (button, text boxes, labels, etc.) you may want to delete or hide these to create a clean version of your presentation. Below is a script you can use hide all of the controls (or you can filter). My example uses PowerPoint 2010 but should apply to most recent versions:

 

1. Create a new module: ppt1

2. Paste the below text:

Public Sub HideControls()

'keep a count of how many items hidden - just fyi
Dim cntrlCount As Integer
    'loop through slides
    For Each sld In ActivePresentation.Slides
        'loop through slide shapes - includes button, text boxes, ole controls, etc
        For Each shp In sld.Shapes
        
        ''Filter here if you want - by name or type
        ' If InStr(shp.Name, "command") >= 1 Then
        ' If shp.Type = 3 Then
        
        'set hidden
        shp.Visible = False
        
        'if you wanted to delete*: shp.Delete
        
        cntrlCount = cntrlCount + 1
        
        Next
    
    Next

MsgBox cntrlCount & " items affected."

End Sub

3. Click Run (green play button) to run this code and hide your controls. ppt2

 

If you want to show or unhide your controls, change shp.Visible = False to shp.Visible = True

 

*Note: if you use shp.Delete, you won’t be able to recover your items.

Remove or Hide PowerPoint Controls on All Slides

PowerPoint VBA / Macro Controls On Slides – Return Focus To The Slide

I recently had the need to add some functionality to some PowerPoint presentations. While it was “fun” to use VBA (brought be back to the classic .asp days) I had forgotten a few issues. One main issue, if you have a button on a slide, when the button is clicked, the focus still remains on the button, not the slide. If you press next or use a presentation ‘clicker’ it won’t advance the slide because you’re still focused on the button. The easiest way I’ve found to return focus back to the slide is by hiding and showing the control. See below:

Private Sub cmdYourButton_Click()
'Do something cool here
cmdYourButton.Visible = False
cmdYourButton.Visible = True
'Focus is now back on the slide!
End Sub

One final note: if you’re looking for the “Developer” tab in PowerPoint, go to File > Options > Customize Ribbon and check “Developer” under ‘Main Tabs’.

Happy presenting!

PowerPoint VBA / Macro Controls On Slides – Return Focus To The Slide