I'd like to have a simple macro run whenever I enter a new slide, whether I got there by normal click-to-advance or by following a link within the slideshow. Is this possible? I've searched for some kind of "page" or "slide" object upon which I could add an "enter" or "load" action, but if it exists I have not found it yet.
The goal is to set a "previous slide" global var, which is used to implement a Back button. Note that this button returns the user to the last slide he or she was on, not necessarily the previous slide in order. That is, on slide #4 I click a link to slide #101 in the appendix, then click Back and I go back to #4, not #100. This works fine, I just need to know which slide I was at.
As a workaround, I'm adding an invisible object to the slide master, with a mouse-over action to call this macro. This should work, but it seems ugly.
Is there a better way? Thank you!
Here's the code which worked:
Public PreviousSlideIndex As Long Public CurrentSlideIndex As Long Public Sub OnSlideShowPageChange(ByVal Window As SlideShowWindow) PreviousSlideIndex = CurrentSlideIndex CurrentSlideIndex = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex End Sub Sub ReturnToPreviousSlide() ActivePresentation.SlideShowWindow.View.GoToSlide PreviousSlideIndex End Sub
ReturnToPreviousSlide to the OnClick action for my Back button, and all's good.
You could make this a little sophisticated with a stack of previous pages, allowing users to futz around for a few slides and still return from whence they came.