GoTo Slide

P

Patrick D.

Hi

In PowerPoint 2007 I can jump to any slide with the VBA command
ActivePresentation.SlideShowWindow.View.GotoSlide (2)

As soon as I insert further slides, the slide-numbers wont be the same.
What is the easiest way to ALWAYS jump to the correct slide?

Patrick
 
J

John Wilson

If you know the SlideID of the target slide you can use something like this
(assuming ID = 257)

Sub jump_To_ID()
Dim I_ID As Integer
I_ID = ActivePresentation.Slides.FindBySlideID(257).SlideIndex
SlideShowWindows(1).View.GotoSlide (I_ID)
End Sub

You can find the SlideID of a slide with

MsgBox ActiveWindow.View.Slide.SlideID

or there's a routine here to temporarily print the ID 's on all your slides

http://www.pptalchemy.co.uk/PowerPoint_vba_SlideID.html
--
john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
PPTLive Atlanta 2009
 
D

David Marcovitz

Another option is to name the slide and then:

ActivePresenation.SlideShowWindow.View.GotoSlide _
ActivePresenation.Slides("The Slide Name").SlideIndex

Just replace The Slide Name with whatever you named the slide. You can use
the routines in Example 8.7 on my site to find or set the name of the slide
(http://www.PowerfulPowerPoint.com/).

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top