Results 1 to 4 of 4

Thread: Random SlideShow Powerpoint

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    67
    Location

    Random SlideShow Powerpoint

    Hi everyone,

    First post here! I'll try to keep it clean! I promise!

    I am trying write a macro that makes a random Slideshow out of a Presentation. Downloading an AddIn that does it is not an option (Specially if it's not freeware).

    Here is the code I wrote.
    What does it do?
    0. There is an open presentation.
    1. Build an array containing the ID's of the slides of the presentation.
    2. Shuffle the array containing the ID's.
    3. Create a NamedSideShow.
    4. Run it.
    5. Delete the NamedSlideShow ( I don't know if it really deletes it).

    The problem is that even when it randomly Shuffles the array, the NamedSlideShow created seems to have the order of the slides of the presentation (Not Shuffled).

    Any Idea of how to do that?


    Sub RandomSlideShow()
    Dim numSlides As Integer
    Dim i As Integer
    numSlides = ActivePresentation.Slides.Count 'Counts the number of Slides of the presentation
    Dim qSlides() As Long 'Dynamically created
    ReDim qSlides(1 To numSlides) As Long '
    'Store the ID of every slide in qSlides
    For i = 1 To numSlides
        qSlides(i) = ActivePresentation.Slides.Item(i).SlideID
    Next
    ArrayShuffle (qSlides) 'Randomizes the positions of the slides ID.
    With ActivePresentation.SlideShowSettings
        .NamedSlideShows.Add "Show Random", qSlides
        .RangeType = ppShowNamedSlideShow
        .SlideShowName = "Show Random"
        .AdvanceMode = ppSlideShowUseSlideTimings
        .Run
        .NamedSlideShows.Item("Show Random").Delete
    End With
    End Sub
    Next Doubts:

    In the future I would like to create some kind of keyboard event so that when a certain key was pressed the presentation would continue without the slide. Any Guideline/ Idea?
    Last edited by Aussiebear; 04-28-2023 at 01:14 AM. Reason: Adjusted the code tags

Posting Permissions

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