Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a macro "OnEnterSlide" or "OnLeaveSlide" in Powerpoint VBA?

Tags:

powerpoint

vba

Is there some kind of event which allows to run a macro any time one enters a slide or leave a slide ?

like image 322
user310291 Avatar asked Jun 05 '10 09:06

user310291


1 Answers

SlideShowNextSlide or OnSlideShowPageChange

You can find the full list at http://officeone.mvps.org/vba/events_version.html

Code sample from http://msdn.microsoft.com/en-us/library/aa211571%28office.11%29.aspx


This example determines the slide position for the slide following the SlideShowNextSlide event.

If the next slide is slide three, the example changes the type of pointer to a pen and the pen color to red.

Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)

Dim Showpos As Integer

Showpos = Wn.View.CurrentShowPosition + 1


 If Showpos = 3 Then  
     With ActivePresentation.SlideShowSettings.Run.View
        .PointerColor.RGB = RGB(255, 0, 0)
        .PointerType = ppSlideShowPointerPen
     End With
  Else
     With ActivePresentation.SlideShowSettings.Run.View
        .PointerColor.RGB = RGB(0, 0, 0)
        .PointerType = ppSlideShowPointerArrow
     End With
  End If
End Sub
like image 55
Dr. belisarius Avatar answered Sep 30 '22 01:09

Dr. belisarius