Reputation: 783
ActivePresentation.SlideShowWindow.View.GotoSlide x
requires us to enter the slide number, which is varying. If I refer it to Slide Number 3 and then move the position of Slide 3, the code wouldn't refer to that slide anymore.
How do I overcome this by referring to the SlideID or SlideName instead of Slide Number.
Thank you.
Upvotes: 0
Views: 902
Reputation: 14809
If I understand the question correctly, you want to be able to go to a particular slide in the presentation regardless of where it may appear in the presentation (ie because other slides have been added before it or it's been moved to a different position).
If so, you could tag the presentation with the slide's SlideID:
ActivePresentation.Tags.Add "IndexSlide", Cstr(lSlideID)
(where IndexSlide is any convenient name you've assigned to the slide; you can have multiple tags for different slides you want to track. And lSlideID is, of course, the slide's SlideID
You'd need to write a function to retrieve the slide's SlideIndex, given the SlideID and call it like so (aircode ... you might have to move/remove a paren or two):
ActivePresentationSlideShowWindow.View.GoToSlide ( _
SlideIndexFromSlideID(cLng(ActivePresentation.Tags("IndexSlide")))
This gets the tag named IndexSlide from the presentation which is the SlideID of IndexSlide, converts it to a Long (tags are strings), passes it to your SlideIndexFromSlideID function, which returns the slide's current SlideIndex ... for you to GoToSlide with.
[Later: adding the needed function for returning SlideIndex]
Function SlideIndexFromSlideID(lSlideID As Long) As Long
SlideIndexFromSlideID = ActivePresentation.Slides.FindBySlideID(lSlideID).SlideIndex
End Function
Upvotes: 2