PowerPoint VBA Code: Reapply the Notes Master

Created: Thursday, January 23, 2020, posted by at 9:30 am


The Notes Master does not work as predictably as the Slide Master in PowerPoint, and you have to reset (sorry, reapply) the Notes Master to individual Notes pages to see some changes you made. Why is that so? That’s mainly because there’s no way to select all Notes Pages in your presentation at the same time.

Even if you go are courageous enough to do this task manually, one Notes Page at a time, you will only see the Reapply master option when you first right-click an empty area within Notes Page view to bring up the contextual menu, as shown in Figure 1, below. You then need to choose the Notes Layout option in this menu, highlighted in red within Figure 1 to bring up a dialog box of the same name, as shown in Figure 2, below. You then check the Reapply master option, shown highlighted in red within Figure 2, below. Do the same for forty or a hundred slides, and you may not be too delighted, to say it lightly!

Right-click an empty area within Notes Page view
Figure 1: Right-click an empty area within Notes Page view

Reapply Notes Master
Figure 2: Reapply Notes Master

Would VBA provide an easier and more elegant solution? Steve Rindsberg of PowerPoint FAQ and PPTools believes you can get this task done is so much less time.

First you need to know how you can run VBA scripts in PowerPoint — then use this code. Explore the code a bit though.

Sub ApplyMasterToNotes()
 
' Modified version of code originally posted to 
' msnews.microsoft.com public newsgroups by 
' David Foster in May of 1999
 
    Dim ctl As CommandBarControl
    Dim oSl As Slide
 
    ' 700 is the control ID for Layout
    Set ctl = CommandBars.FindControl(Id:=700)
    ActiveWindow.ViewType = ppViewNotesPage
 
    If (ctl Is Nothing) Then
        MsgBox "command not available"
        Exit Sub
    End If
 
    For Each oSl In ActivePresentation.Slides
 
        ' go to the current slide
        ActiveWindow.View.GotoSlide (oSl.SlideIndex)
        DoEvents
 
        ' Bring up the dialog
        ctl.Execute
        DoEvents
 
        ' send it the needed keystrokes
        SendKeys "%r{enter}"
        DoEvents
 
    Next
 
End Sub

Once you have placed this code in the VBA editor, close the window to get back to your PowerPoint window. Before you proceed further, it’s a great idea to save your file. Make sure that you save as a PowerPoint Macro-Enabled Presentation with the PPTM file extension. If you save as any of the other file formats, PowerPoint will offer to remove the macros, and then, of course, the code to reapply the Notes Master will not work! See our PowerPoint File Formats page to learn about these file formats.

Then open or switch to the presentation where you need this code, and run the macro. To do so, press the Alt + F8 shortcut key. In the Macro dialog box that appears, next to Macro in: choose All open presentations, as shown in Figure 3, below. Click the ApplyMasterToNotes Macro name, and then click the Run button, highlighted in red within Figure 3, below.

Run the ApplyMasterToNotes Macro
Figure 3: Run the ApplyMasterToNotes Macro

We tested this code using PowerPoint 365 for Windows.

You May Also Like: Use VBA in PowerPoint, Even if You Can’t Program for Nuts | Create Spirographs in PowerPoint Programmatically | Resources on PowerPoint Programming and VBA


Steve Rindsberg
  
Steve Rindsberg has been associated with PowerPoint since the product originated more than two decades ago — his PowerPoint FAQ site is a treasure trove of PowerPoint information.

When he’s not updating his site, he’s working on his popular PPTools add-ins for PowerPoint. Steve’s also into a lot of print technology related stuff.

See Also: VBA: Change One Shape to Another in PowerPoint



Related Posts

Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.

Plagiarism will be detected by Copyscape

© 2000-2020, Geetesh Bajaj - All rights reserved.

since November 02, 2000



-->