What VBA code is needed for selecting a slide?

  • Thread starter Henk van Winkoop
  • Start date
H

Henk van Winkoop

Hello,

I would like my VBA code to show a specific slide during a presentation
which same slide should also be selected if another slide is inserted
manually lateron.

VBA works with slidenumbers which are different from slidenumbers used by
PowerPoint itself.

'for example

SlideShowWindows(1).View.GotoSlide(5)

'always goes to the 5th slide so if another slide is inserted it shows the
wrong slide

all tips are welcome

regards,

Henk
 
S

Shyam Pillai

Each slide has a unique ID stored in the property SlideID. You can get a
reference to the slide in the presentation by it's slide id using
FindBySlideID method. Once you get the reference to the slide, you can use
it's SlideIndex in the GotoSlide method to arrive at the correct slide.

--
Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
 
G

Guest

Hi Henk

You need to use the slideID which does not change.

Code

Sub jump()
ActivePresentation.FollowHyperlink _
'blank address = this pres
Address:="", _
SubAddress:="258,,"
End Sub

Where 258 is the slideID. You can find the ID for a slide by selecting it
and running this code (note no error checking so be sure to select one shape)

Sub checkID()
MsgBox ActiveWindow.Selection.SlideRange.SlideID
End Sub
 

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