I am having to use the dreaded OnSlideShowPageChange event (instead of the application events object) in a project that needs to be compatible with both PC and Mac versions of PowerPoint. The macro has to detect when a slide show starts and then add certain objects to all slides, deleting them again when the slide show ends. To do this, I am using the OnSlideShowPageChange event to detect when the slide show starts, exit the show, add the objects to the slides in the normal view before restarting the show. Everything is working as expected but the OnSlideShowPageChange macro crashes as it exits (I put a break point on the End Sub line which it reaches without error and then crashes as I step into it).
#If Mac Then
Public IgnoreEvents As Boolean
Public ObjectsExist As Boolean
Public Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow)
If Not IgnoreEvents And Not ObjectsExist Then
IgnoreEvents = True
AddSlideObjects ' This procedure adds some shapes to each slide in the deck and is working as expected
IgnoreEvents = False
Public Sub OnSlideShowTerminate(ByVal Wn As SlideShowWindow)
If Not IgnoreEvents Then
DeleteSlideObjects ' This procedure deletes the added shapes from each slide in the deck and is working as expected
Any idea why the OnSlideShowPageChange procedure is crashing PowerPoint as it exists?