Powerful PowerPoint for Educators: Using Visual Basic for Applications to Make PowerPoint Interactive


If numRead >= numWanted Or numRead >= numSlides - 2 Then


Download 1.37 Mb.
Pdf ko'rish
bet154/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   150   151   152   153   154   155   156   157   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

If numRead >= numWanted Or numRead >= numSlides - 2 Then
numWanted
was set in 
Ini 
tial 
ize
to be 5; that is, we want to ask five ques -
tions at a time. You can change that number in 
Ini 
tial 
ize
if you want to ask
more or fewer than five questions at a time, or you can ask the user how many
questions to do (see be low).
If we have asked enough ques tions,
RandomNext
jumps to the last slide.
Otherwise, it ran domly picks a new slide to jump to. Randomly picking an other
slide is very easy us ing
Rnd
, but we want to make sure we are jump ing to a slide
that we haven’t seen yet. First we ran domly pick a slide:
nextSlide = Int((numSlides - 2) * Rnd + 2)
This assigns the randomly chosen slide to
nextSlide
. The 
While
loop keeps
looping as long as we have seen the cho sen slide (
vis 
ited(nextSlide) =
True
). That is, if we pick slide 7 as our next slide,
vis 
ited(7)
will be 
True
if
we have seen slide 7, so we will keep loop ing, and pick an other slide with
nextSlide = Int((numSlides - 2) * Rnd + 2)
. Once we have picked the
next slide, we can go there with:
ActivePresentation.SlideShowWindow.View.GotoSlide (nextSlide)
That is all you need to choose a few questions from a pool of questions. To add
more ques tions, you don’t have to change any VBA at all; just add more question
slides be tween the first and last slide. If you want to ask a dif ferent number of
questions, you can either change
numWanted = 5
to an other number in the
Ini 
tial 
ize
pro cedure, or you can try out the code in the next section.
This is a good place to re mind you that you can and should use all the tra di-
tional PowerPoint tools at your dis posal. For many of the ques tions I have made
148 More Tricks for Your Scripting Bag


for my daugh ter, I in clude pic tures from clip art for the answers in stead of regu-
lar buttons. I also use sounds lib erally. The most important use of sound (aside
from the applause at the end) is sound for difficult words or sentences. If I in-
clude a word or sentence that might be be yond my daughter’s skills, I add a re -
corded sound of me reading the word or sentence. She knows that she can click
on any speaker icon to have something read to her. While I am not a big fan of
bells and whistles, you should use as many traditional features of PowerPoint as
you think are appropriate.

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   150   151   152   153   154   155   156   157   ...   191




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling