Basically what I'm trying to accomplish by doing it this way is to have four
games in one presentation (the same game with different result). These four
slides look exactly the same in appearance. I don't want my player to
realize which slide they are on so each time the game is played it's
different. I've found two codes that randomize the every slide but only want
to randomize some. Can I modify these to suit my needs? If so how? Or do I
need something entirely different?
First method:
ActivePresentation.SlideShowWindow_
.View.GotoSlide Int(Rnd * _
ActivePresentation.slides.Count) + 1
Second method:
Dim i As Integer
Dim myvalue As Integer
Dim islides As Integer
islides = ActivePresentation.Slides.Count
For i = 1 To ActivePresentation.Slides.Count
myvalue = Int((i * Rnd) + 1)
ActiveWindow.ViewType = ppViewSlideSorter
ActivePresentation.Slides(myvalue).Select
ActiveWindow.Selection.Cut
ActivePresentation.Slides(islides - 1).Select
ActiveWindow.View.Paste
Next
Am more than willing to buy the add-in from
(http://www.tushar-mehta.com/powerpoint/randomslideshow/), but want to learn
how to do this on my own.
thanks,
Mike
This should be very easy because all you want to do is randomly choose
slides 2, 3, 4, or 5. Is that correct? That is, you want to jump to one of
those slides and then after that jump to slide 6. Or do you want to go
through slides 2, 3, 4 and 5 in random order and then go to slide 6. That
would be a little harder but not too difficult.
Just to jump to one random slide would be something like:
Sub GoToRandom2345()
Dim nextSlide As Long
Randomize
nextSlide = Int(Rnd * 4) + 2
ActivePresentation.SlideShowWindow.View.GotoSlide nextSlide
End Sub
The hard part about going through those slides in random order is simply
keeping track of which ones you have been two. The simplest way is something
like this:
Dim doneSlide(6) As Boolean
Sub GetStarted()
Initialize
GoToRandom
End Sub
Sub Initialize()
Dim i As Long
For i = 2 To 5
doneSlide(i) = False
Next i
End Sub
Sub GoToRandom()
Dim nextSlide As Long
Randomize
If doneSlide(2) And doneSlide(3) And doneSlide(4) And doneSlide(5) Then
ActivePresentation.SlideShowWindow.View.GotoSlide 6
Else
nextSlide = Int(Rnd * 4) + 2
While doneSlide(nextSlide)
nextSlide = Int(Rnd * 4) + 2
Wend
doneSlide(nextSlide) = True
ActivePresentation.SlideShowWindow.View.GotoSlide nextSlide
End If
End Sub
Just set the button on your first slide to GetStarted and a button on slides
2, 3, 4, and 5 to GoToRandom.
--David
On 7/1/09 10:23 AM, in article
B56FE6C3-F208-4E10...@microsoft.com, "Preschool Mike"
<Presch...@discussions.microsoft.com> wrote:
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
Int(Rnd * <number of slides>) + <start slide>
Thus, if you want to randomly select from 100 slides, you would change the 4
to 100. If you want the first random slide to be slide 17, you would change
the 2 to 17. No names are involved here; it is all used SlideIndex. To do
this with names would add a whole new level of complexity...although I
suppose if the first slide in your list of random slides is named (say,
FirstRandom), you could easily use:
nextSlide = Int(Rnd * 4) +
ActivePresentation.Slides("FirstRandom").SlideIndex
On 7/1/09 11:35 AM, in article
C1B0A806-C4D8-4CB8...@microsoft.com, "Preschool Mike"
Thanks so much,
Mike
2. Another way to make randomness is to stretch invisible squares to fill a
clicked area with each square filling a different area of the area to be
clicked. Assign a hyper-link to each square and make the squares taking
almost the same fraction of the space to be clicked to maximize randomness.