Results 1 to 5 of 5

Thread: Cannot go back to previous slides

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Post Cannot go back to previous slides

    Hi this is my very first post.

    I have been trying to get my code to work for over a month now with no success. I have tried smaller codes and much larger codes and none seem to work.

    My Code should remember the last 10 PowerPoint slides that I have visited, so when I use a shape to run the Sub GoBack() the slides will go back each time to previous slide I had visited.

    I want this to work automatically so when the slide is visited the Sub AddSlideToList() is activated.


    The code Sub AddSlideToList() is not being activated at all. If I use a shape to run the Sub AddSlideToList() when on the slide that slide number is shown in the Immediate Window which is correct. (Added slide ? to list) and I can then use a shape Sub GoBack() which works fine.

    The issues is this code will not run on its own as its meant to do. I have no idea what I am doing wrong. I am running this code in Module 1
    I only want to be able to us Sub GoBack() Are you able to help please.


    Private Sub SlideShowNextSlide(ByVal Wn As SlideShowWindow)
        AddSlideToList 'Call the AddSlideToList Sub when the slide changes
    End Sub
    
    Sub AddSlideToList()
        If SlideList.Count = 10 Then SlideList.Remove 1
        SlideList.Add ActivePresentation.SlideShowWindow.View.Slide.SlideNumber
        Debug.Print "Added slide " & ActivePresentation.SlideShowWindow.View.Slide.SlideNumber & " to list"
    End Sub
    
    Sub GoBack()
        If SlideList.Count > 0 Then
            Dim SlideNumber As Long
            SlideNumber = SlideList(SlideList.Count)
            SlideList.Remove SlideList.Count
            ActivePresentation.SlideShowWindow.View.GotoSlide SlideNumber
        End If
    End Sub


    My Immediate window will look like this if i run the Sub AddSlideToList() manually

    -1
    Added slide 3 to list
    Added slide 3 to list
    Added slide 4 to list
    Added slide 5 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 8 to list
    Added slide 10 to list
    Added slide 11 to list
    Added slide 7 to list
    Added slide 1 to list
    Added slide 1 to list
    Added slide 1 to list
    Added slide 2 to list
    Added slide 3 to list
    Added slide 6 to list
    Added slide 10 to list
    Added slide 11 to list
    Added slide 4 to list
    Added slide 3 to list
    Added slide 4 to list
    Added slide 5 to list
    Added slide 7 to list
    Added slide 10 to list
    Last edited by Aussiebear; 03-31-2023 at 02:07 PM. Reason: Added code tags to supplied code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •