jmaocubo
05-29-2012, 07:57 AM
Hello all
I was looking at the site for the code "random slideshow". But I only found the code that random slides except the 1st slide.
How can I do to avoid the shuffle on the 1st and the last slide?
I'm using:
Sub aleatorio()
Dim intSlideCount As Integer
Dim intRandomCut As Integer
Dim intRandomPaste As Integer
Dim intLoopCounter As Integer
'Count number of slides excluding the first two (don't want these shuffled)
'.Slides.Count - 1
intSlideCount = Application.ActivePresentation.Slides.Count
intSlideCount = intSlideCount - 2
' Initialize random-number generator.
Randomize
'Repeat the random change 8 times
For intLoopCounter = 0 To 8
' Generate random value between 3 and last slide.
intRandomCut = Int((intSlideCount * Rnd) + 3)
intRandomPaste = Int((intSlideCount * Rnd) + 3)
'Move a randomly chosen slide from 1 position to another
ActivePresentation.Slides(intRandomCut).MoveTo toPos:=intRandomPaste
Next
End Sub
Thanks in advance
Miguel
I was looking at the site for the code "random slideshow". But I only found the code that random slides except the 1st slide.
How can I do to avoid the shuffle on the 1st and the last slide?
I'm using:
Sub aleatorio()
Dim intSlideCount As Integer
Dim intRandomCut As Integer
Dim intRandomPaste As Integer
Dim intLoopCounter As Integer
'Count number of slides excluding the first two (don't want these shuffled)
'.Slides.Count - 1
intSlideCount = Application.ActivePresentation.Slides.Count
intSlideCount = intSlideCount - 2
' Initialize random-number generator.
Randomize
'Repeat the random change 8 times
For intLoopCounter = 0 To 8
' Generate random value between 3 and last slide.
intRandomCut = Int((intSlideCount * Rnd) + 3)
intRandomPaste = Int((intSlideCount * Rnd) + 3)
'Move a randomly chosen slide from 1 position to another
ActivePresentation.Slides(intRandomCut).MoveTo toPos:=intRandomPaste
Next
End Sub
Thanks in advance
Miguel