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


End Sub This procedure uses a For


Download 1.37 Mb.
Pdf ko'rish
bet137/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   133   134   135   136   137   138   139   140   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

End Sub
This procedure uses a
For
loop, just like what we saw above in “Looping.” It
loops through each of the members of the 
qAnswered
ar ray and sets each to
False
. In the orig inal version, every time you added a new question, you would
need to add a new
Dim
state ment and a new line in
Ini 
tial 
ize
. Now, the only
thing you have to change is the number “5” in your 
Dim
state ment and in the 
For
line of your 
Ini 
tial 
ize
pro ce dure.
Having a separate vari able for each question was only a lit tle inconvenient.
The big gest in con ve nience was hav ing a sep a rate
RightAnswer
and
WrongAnswer
pro cedure for each ques tion. We needed this
1. to 
assign
True
or 
False
to the cor rect
qAnswered
vari able;
2.
to know which question was be ing an swered so we could know which
was the ap pro pri ate
qAnswered
vari able for number 1; and
3.
in later ex amples, to as sign the ac tual answer to the correct
an 
swer
vari able.
Ar rays 135


Our array takes care of num ber 1. Number 2 can be handled easily if our
questions are all in or der. In our ex amples with the questions beginning on slide
2, each question is one less than the slide num ber (i.e., question 1 is on slide 2,
question 2 is on slide 3, etc.), so to get the ques tion num ber, we simply sub tract
one from the slide number (
ActivePresentation.SlideShowWindow.
View.Slide.SlideIndex - 1
). We’ll take care of num ber 3 in the next section.
Us ing the

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   133   134   135   136   137   138   139   140   ...   191




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