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


Download 1.37 Mb.
Pdf ko'rish
bet49/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   45   46   47   48   49   50   51   52   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Figure 5.3. Sim ple Quiz
Force the Stu dent to Type Something
Now, you have a nice procedure to ask for a name, but some students will
not want to type their names. We have ways of mak ing them type. Let’s ex pand
our pro cedure to what is shown in Fig ure 5.4 (page 55).
This example is a little more com plicated than nec essary (i.e., the same
thing could have been done with four or five lines of code), but the com plexity
makes it easier to change. As a scripter, you al ways want to know what you can
change. But first, let’s try to un derstand what the pro cedure is do ing. If you don’t
understand it all, don’t worry; you can type the examples ex actly as they are
without un 
derstanding any 
thing, and you can make small changes without
understanding very much.
You should recognize the line be ginning with
userName =
. That is the core
of our old 
YourName
pro cedure. The rest of the pro cedure is de signed to fig ure
out if the stu dent has typed any thing and, if not, ask the stu dent again for a name.
Force the Student to Type Something 55


Figure 5.4. Ask For and Re quire a Name
To de cide if the stu dent has typed any thing, we use a vari able named
done
.
When
done
is 
True
, the user has typed something. When
done
is 
False
, the
user has n’t typed any thing. You might no tice that we de clared this variable in -
side the pro cedure
YourName
. This means that only
YourName
will know about
done
(it would work just fine to declare
done
at the be ginning of the mod ule
right be fore or af ter the 
Dim
state ment for

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   45   46   47   48   49   50   51   52   ...   191




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