Remove Notes Pages in PowerPoint (VBScript)

Introduction

This VBS demo illustrates how to remove notes pages in PowerPoint 2003 and the later version.

Scenarios

Removing notes pages in PowerPoint is a frequently asked question by users in the Answers forums. For example,

Script

Step1. Double-click "Starter.bat".
 
 
Step2.  Press any key to continue.       
 
Step3. Select PPT files with notes pages from a folder, and then click the Open button.
 
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
VB Script
Edit|Remove
Dim pptApp 
Dim fd 
Dim vntSelectedItem 
 
Set pptApp = CreateObject("PowerPoint.Application") 
 
' Create a FileDialog object as a File Open dialog box. 
Set fd = pptApp.FileDialog(3) 
 
'/* To reference the FileDialog object .*/ 
With fd 
    .AllowMultiSelect = True 
    .Filters.Clear 
    .Filters.Add "All PowerPoint Presentations""*.pptx,*.ppt,*.pptm,*.ppsx,*.pps,*.ppsm,*.potx,*.pot,*.potm,*.odp" 
    .Title = "Select Presentations to Operate" 
     
    '/* The user pressed the button .*/ 
    If .Show = -1 Then 
        Dim myPPT 
        Dim strResult 
        Dim iNow 
        Dim iAll 
        Dim mySlide 
        Dim mySlides 
         
        iNow = 0 
        iAll = .SelectedItems.Count 
         
        '/* Step thru each string in the FileDialogSelectedItems collection. */ 
        For Each vntSelectedItem In .SelectedItems 
             
            ' To reference the opening presentation object. 
            Set myPPT = pptApp.Presentations.Open(vntSelectedItem, , , 0) 
            ' Set the counter. 
            iNow = iNow + 1 
            ' Display the progress. 
            WScript.Echo CStr(iNow) & "/" & CStr(iAll) & Chr(9) & myPPT.Name 
             
            With myPPT 
                Set mySlides = .Slides 
                 
                '/* Step thru each slide. */ 
                For Each mySlide In mySlides 
                    If mySlide.NotesPage.Shapes.Count > 0 Then 
                        mySlide.NotesPage.Shapes.Range.Delete 
                    End If 
                Next 
                 
                .Save 
                .Close 
            End With 
             
        Next 
         
        ' Reminding for task completed in command line. 
        WScript.Echo Chr(10) & _ 
                     "*****************" & Chr(10) & _ 
                     " Task completed! " & Chr(10) & _ 
                     "*****************" & Chr(10) 
         
        '/* Set the object variable to nothing. */ 
        Set myPPT = Nothing 
        Set mySlide = Nothing 
        Set mySlides = Nothing 
    End If 
     
End With 
 
' Set the object variable to nothing. 
Set fd = Nothing 
' Exit the created instance of PowerPoint application. 
pptApp.Quit

Additional Resources

Presentation.DocumentInspectors Property (PowerPoint)
Application.FileDialog Property (PowerPoint)
Related forum threads:
http://answers.microsoft.com/thread/a7fd4f03-9759-4556-80be-0eeca59105d0
http://www.ozgrid.com/forum/showthread.php?t=162428