Select Page

PowerPoint supports a range of events that fit into one of three categories:

  1. Pseudo or auto-macro events – older, unstable events
  2. Application object events – new object model events
  3. Add-in auto macros – pseudo events that fire when add-ins load and unload

These are covered below. Note that although many events are supported by the older non-ribbon versions of PowerPoint, we don’t include them here as these are more than 10 years old.

Pseudo or Auto-Macro Events

These events are the original ones developed by Microsoft for PowerPoint 97 so are very old now. While they remain within the VBA environment, it is not recommended to use them as they are buggy and hence unreliable. You should use the application object events whenever you need an event and there is only really one exception and that’s when you need events to work on PC and Mac versions of PowerPoint (PowerPoint:mac 2011 & 2016 doesn’t support the application event object model.

To use a pseudo event, you just declare the procedure using the signatures below. Nothing else is needed.

PowerPoint PC PowerPoint Mac
Psuedo Event Description Signature 2016 2013 2010 2007 2016 2011
OnSlideShowPageChange Occurs after showing the new slide. OnSlideShowPageChange(ByVal oWindow As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
OnSlideShowTerminate Occurs after terminating any slide show. OnSlideShowTerminate(ByVal oWindow As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
OnSlideShowNextBuild Occurs when the slide show progresses to the next animation build within the current slide. This event does not fire when the slide show progresses to next or previous slides. OnSlideShowNextBuild(ByVal oWindow As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
OnSlideShowPreviousBuild Occurs when the slide show progresses to the previous animation build within the current slide. This event does not fire when the slide show progresses to next or previous slides. OnSlideShowPreviousBuild(ByVal oWindow As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X

Issue 1

Note that the OnSlideShowPageChange can cause PowerPoint to crash if you use it to control the slideshow. Try this for example:

Sub OnSlideShowPageChange (oWn as SlideshowWindow)

oWn.View.Exit

ActivePresentation.SlideshowSettings.Run

End Sub

Issue 2

The OnSlideShowPageChange event doesn’t fire from a macro-enabled slide show file (.ppsm or .pps). To overcome this limitation, we can trick PowerPoint into initialising the pseudo events by adding any Active-X control from the Developer tab of the PowerPoint ribbon to your slide (add it to the off-slide workspace to avoid seeing it during the slide show).

Application Object Events

The newer, more numerous set of 33 events are much more stable and are maintained by Microsoft, even added to over the more recent revisions but the one single drawback is that they are not supported by Mac versions of PowerPoint.

 

PowerPoint PC PowerPoint Mac
Application Event Description Signature 2016 2013 2010 2007 2016* 2011
AfterDragDropOnSlide Occurs after a shape has been dropped onto a slide in an open presentation. AfterDragDropOnSlide(ByVal oSld As Slide, ByVal X As Single, ByVal Y As Single)
  • X
  • X
  • X
  • X
  • X
  • X
AfterNewPresentation Occurs after a presentation is created. AfterNewPresentation(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
AfterPresentationOpen Occurs after an existing presentation is opened. PresentationOpen(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
AfterShapeSizeChange Occurs after an object (shape, picture, text box, chart, SmartArt as examples) has been resized on the slide. AfterShapeSizeChange(ByVal oShp As Shape)
  • X
  • X
  • X
  • X
  • X
  • X
ColorSchemeChanged Occurs after a color scheme is changed. ColorSchemeChanged(ByVal oSldRng As SlideRange)
  • X
  • X
  • X
  • X
  • X
  • X
NewPresentation Occurs after a presentation is created, as it is added to the Presentations collection. NewPresentation(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationBeforeClose Represents a Presentation object before it closes. PresentationBeforeClose(ByVal oPres As Presentation, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationBeforeSave Occurs before a presentation is saved. PresentationBeforeSave(ByVal oPres As Presentation, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationClose Occurs immediately before any open presentation closes, as it is removed from the Presentations collection. PresentationClose(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationCloseFinal Represents closing the final Presentation object. PresentationCloseFinal(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationNewSlide Occurs when a new slide is created in any open presentation, as the slide is added to the Slides collection. PresentationNewSlide(ByVal oSld As Slide)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationOpen Occurs after an existing presentation is opened, as it is added to the Presentations collection. PresentationOpen(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationPrint Occurs before a presentation is printed. PresentationPrint(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationSave Occurs before any open presentation is saved. PresentationSave(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
PresentationSync Occurs when the local copy of a presentation that is part of a Document Workspace is synchronised with the copy on the server. Provides important status information regarding the success or failure of the synchronisation of the presentation. PresentationSync(ByVal oPres As Presentation, ByVal SyncET As Office.MsoSyncEventType)
  • X
  • X
  • X
  • X
  • X
  • X
ProtectedViewWindowActivate Occurs when any protected view window is activated. ProtectedViewWindowActivate(ByVal oPVWn As ProtectedViewWindow)
  • X
  • X
  • X
  • X
  • X
  • X
ProtectedViewWindowBeforeClose Occurs immediately before a protected view window or a document in a protected view window closes. ProtectedViewWindowBeforeClose(ByVal oPVWn As ProtectedViewWindow, ByVal Reason As PpProtectedViewCloseReason, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
ProtectedViewWindowBeforeEdit Occurs immediately before editing is enabled on the document in the specified protected view window. ProtectedViewWindowBeforeEdit(ByVal oPVWn As ProtectedViewWindow, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
ProtectedViewWindowDeactivate Occurs when a protected view window is deactivated. ProtectedViewWindowDeactivate(ByVal oPVWn As ProtectedViewWindow)
  • X
  • X
  • X
  • X
  • X
  • X
ProtectedViewWindowOpen Occurs when a protected view window is opened. ProtectedViewWindowOpen(ByVal oPVWn As ProtectedViewWindow)
  • X
  • X
  • X
  • X
  • X
  • X
SlideSelectionChanged Occurs at different times depending on the current view. SlideSelectionChanged(ByVal oSldRng As SlideRange)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowBegin Occurs when you start a slide show. SlideShowBegin(ByVal oSSWn As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowEnd Occurs after a slide show ends, immediately after the last SlideShowNextSlide event occurs. SlideShowEnd(ByVal oPres As Presentation)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowNextBuild Occurs upon mouse-click or timing animation, but before the animated object becomes visible. SlideShowNextBuild(ByVal oSSWn As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowNextClick Occurs on the next click of the slide. SlideShowNextClick(ByVal oSSWn As SlideShowWindow, ByVal oEffect As Effect)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowNextSlide Occurs immediately before the transition to the next slide. For the first slide, occurs immediately after the SlideShowBegin event. SlideShowNextSlide(ByVal oSSWn As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowOnNext Occurs when the user clicks Next to move within the current slide. SlideShowOnNext(ByVal oSSWn As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
SlideShowOnPrevious Occurs when the user clicks Previous to move within the current slide. SlideShowOnPrevious(ByVal oSSWn As SlideShowWindow)
  • X
  • X
  • X
  • X
  • X
  • X
WindowActivate Occurs when the application window or any document window is activated. WindowActivate(ByVal oPres As Presentation, ByVal oDocWn As DocumentWindow)
  • X
  • X
  • X
  • X
  • X
  • X
WindowBeforeDoubleClick Occurs when you double-click the items in the views listed in the following table. WindowBeforeDoubleClick(ByVal oSel As Selection, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
WindowBeforeRightClick Occurs when you right-click a shape, a slide, a notes page, or some text. This event is triggered by the MouseUp event. WindowBeforeRightClick(ByVal oSel As Selection, Cancel As Boolean)
  • X
  • X
  • X
  • X
  • X
  • X
WindowDeactivate Occurs when the application window or any document window is deactivated. WindowDeactivate(ByVal oPres As Presentation, ByVal oDocWn As DocumentWindow)
  • X
  • X
  • X
  • X
  • X
  • X
WindowSelectionChange Occurs when the selection of text, a shape, or a slide in the active document window changes, whether in the user interface or in code. WindowSelectionChange(ByVal oSel As Selection)
  • X
  • X
  • X
  • X
  • X
  • X

*The checked events for PowerPoint:Mac 2016 (which includes 2019 and Office365) are supported from version 16.X onwards.

Event Firing Order

If we create a presentation with all of the above events within a VBA project, we can see which events are fired and in which order when various actions are taken by a user. Here are a few examples, recorded from PowerPoint 2013 (free sample below):

WindowDeactivate

WindowActivate

SlideSelectionChanged

WindowSelectionChange

PresentationOpen

AfterPresentationOpen

WindowDeactivate

WindowActivate

NewPresentation

AfterNewPresentation

PresentationNewSlide

SlideSelectionChanged

WindowSelectionChange

PresentationBeforeSave

PresentationSave

PresentationNewSlide

SlideSelectionChanged

WindowSelectionChange

SlideShowBegin

SlideShowNextSlide

SlideShowNextClick

SlideShowEnd

WindowActivate

SlideSelectionChanged

WindowSelectionChange

PresentationBeforeClose

PresentationClose

WindowDeactivate

PresentationCloseFinal

WindowActivate

SlideSelectionChanged

WindowSelectionChange

Download free PowerPoint 2013 sample (.pptm)

Using the Event Object Model

To use any of the events above, you need to add the following code to your PowerPoint VBA project and then initialise the event handler:

1. Create a Class Module called clsAppEvents with the following line of code:

Public WithEvents App As Application

2. Select the required event in the VBE procedure drop down for App and write the event code to be run when that event fires:

Sub App_SlideShowOnNext(ByVal Wn As SlideShowWindow)
	Debug.Print "SlideShowOnNext"
	MsgBox "SlideShowOnNext"
	' Add your code here
End Sub

3. Create a standard module with the following:

Dim oEH As New clsAppEvents

4. Initialise the application, for example, in Auto_Open() for an add-in:

Sub InitialiseApp()
	Set oEH.App = Application
End Sub
Download free PowerPoint 2013 sample (.pptm)

Note: If you are not creating an add-in (.ppam or .ppa) then you cannot use Auto_Open to initialise the event handler. There is a way round this for PC versions of PowerPoint that support the ribbon interface e.g. 2016, 2013, 2010, 2007. You will need the free CustomUIEditor to do the following:

1. Open your PowerPoint file in PowerPoint

2. Add a standard module with the following code:

Public Sub onLoadRibbon(myRibbon as IRibbonUI)
	Debug.Print "Ribbon Loaded"
	MsgBox "Ribbon Loaded"
	' Add your code here
End Sub

3. Open your PowerPoint file with the CustomUIEditor

4. Click Insert and then Office 2007 Custom UI Part

5. Enter this XML code into the window:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="onLoadRibbon" ></customUI>

6. Close the file and exit CustomUIEditor

7. Reopen the file in PowerPoint to see the debug message

This method is also useful for avoiding code running when the Auto_Open macro runs without a PowerPoint window being open, for example, when a user previews a presentation in Windows Explorer. In this case, Auto_Open will run but the ribbon isn’t loaded so the onLoadRibbon procedure doesn’t run.

Add-In Auto Macros

To use one of these pseudo events, you just declare the procedure using the signatures below. Nothing else is needed.

PowerPoint PC PowerPoint Mac
Psuedo Event Description Signature 2016 2013 2010 2007 2016 2011
Auto_Open Occurs after the add-in loads. Auto_Open()
  • X
  • X
  • X
  • X
  • X
  • X
Auto_Close Occurs after the add-in unloads. Auto_Close()
  • X
  • X
  • X
  • X
  • X
  • X

If you are not creating an add-in (.ppam or .ppa) then Auto_Open will not fire and you could consider using the XML method described above.