If 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:
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
shp.Visible = False
'if you wanted to delete*: shp.Delete
cntrlCount = cntrlCount + 1
MsgBox cntrlCount & " items affected."
3. Click Run (green play button) to run this code and hide your controls.
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.
So for some reason you have the need to use vbscript (maybe a .vbs file, Excel script, etc) but like many others before you, you have run into a limitation of vbscript. I’m not going to discuss the reasons why / why not to use vbscript, I am already assuming you have a good reason. Onto the example. In this case, we are “fixing” the limitation of vbscript to not handle larger numbers well. We are going to extend our vbscript by creating a .dll library in Visual Studio that allows us to pass and return data in the format we need, in the example case, to round a large decimal number. Continue reading “Creating a .dll library for use in vbscript (.vbs) using Visual Studio”