Consulting

Results 1 to 18 of 18

Thread: How to Randomize Only VISIBLE Slides, Not Hidden Slides??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Feb 2022
    Posts
    37
    Location

    How to Randomize Only VISIBLE Slides, Not Hidden Slides??

    Hello all, I'm trying to make my code only randomize non-hidden slides. I'm a noobie to VBA. I've just tried to figure it out logically, but I'm afraid I lack fundamental coding knowledge to solve this problem.
    There are 6 slides and the code will randomize them successfully if I leave out the If statement about "SlideShowTransition.Hidden = False" - So therein lies the problem...
    Sub RandomVisibleSlides ()
    FirstSlide = 1
    LastSlide = 6
    RSN = SlideIndex
    Randomize
    'generate random number for Index
    GRN:
    RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
    If RSN = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex Then
    If ActivePresentation.Slides(RSN).SlideShowTransition.Hidden = False Then GoTo GRN
    ActivePresentation.SlideShowWindow.View.GotoSlide (RSN)
    End Sub
    My experiment PowerPoint is attached.
    What am I doing wrong?
    Attached Files Attached Files
    Last edited by Aussiebear; 02-23-2022 at 12:15 AM. 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
  •