Go to next tagged slide in array

C

caten

I am trying to provide users a way to advance through only selected slides.
I have tagged the slides I want and created an array to hold the slide index
of those tagged slides. I'd like users to be able to click a button on an
add-in toolbar (which I have already created) and go to the next slide
specified in the array, kind of like the Find Next button.

I can create a procedure that advances through only my tagged slides, but I
don't know how to allow the user to stop and do some editing on each slide
before continuing. So it seems that I need a way for the user to go to the
first tagged slide, and then click to go to the next tagged slide when ready.
I'm stumped as to how to go about this.

Any suggestions?

Here's what I have so far...

Sub advanceSelectedSlides()
' Advance through ILO-Only slides only

Dim oPres As Presentation
Dim oSlides As Slides
Dim oSl As Slide
Dim numSlides As Integer
Dim i As Integer
Dim found As Integer
Dim counter As Integer
Dim arrSlides() As Variant

numSlides = oSlides.Count
found = 0
counter = 0

Set oPres = ActivePresentation
Set oSlides = oPres.Slides
ReDim arrSlides(1 To numSlides)

If IsViewTypeNormal <> True Then
ActiveWindow.ViewType = ppViewNormal
End If

ActiveWindow.View.GotoSlide (1)

For Each oSl In oSlides
With oSl.Tags
For i = 1 To .Count
If .Name(i) = "CONTEXT" And .Value(i) = "ILO Only" Then
found = found + 1
End If
If found <> 0 Then
counter = counter + 1
ReDim Preserve arrSlides(1 To counter)
arrSlides(counter) = .Parent.SlideIndex
Debug.Print .Parent.SlideIndex
found = 0
End If
Next 'i
End With
Next 'oSl

End Sub
 
C

caten

Excellent! Much simpler and does what I need. Thank you for your help.

So now, what if I want to reverse it (go to previous tagged slide)?

I tried changing the For statement to:
For x = ActiveWindow.Selection.SlideRange(1).SlideIndex - 1 _
To ActivePresentation.Slides(1) Step -1

but I get:
Run-time error '438': "Object does not support this property or method".

What am I missing/doing wrong?
 
C

caten

No, this error occurs regardless of the current slide index. (And I did try
adding the check for first slide anyway to see what would happen, but the
same error occurs.) Any other ideas?
 

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