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


Download 1.37 Mb.
Pdf ko'rish
bet148/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   144   145   146   147   148   149   150   151   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Question4
,
Question5
, etc.) and it will change
the text of the ques tion in the
InputBox
state ment and the cor rect an -
swer(s) to check for in the 
If
statement.
3.
If you have a lot of questions, change the font size of the text box in
the
PrintablePage
pro cedure to 9 or smaller.
142 More Tricks for Your Scripting Bag


Ran dom Num bers
Random numbers are a pow erful tool. Of ten you know ex actly what you
want in your presentation and in ex actly what or der. At other times you want to
mix things up randomly. For ex ample, you might want to practice ad dition facts,
but you don’t want to specify ev ery possible combination of one-digit numbers.
Instead you want the computer to ran domly generate prob lems for you. In an -
other example, you might have a large pool of ques tions, but you only want to
ask a few that are randomly se lected. This section explores these examples.
To have the computer generate ran dom numbers, you need to know three
things:
Ran 
dom 
ize
,
Rnd
, and 
Int
. For you math pur ists, computers can not gen -
erate truly random numbers, but they can come close enough for al most any
purpose.
To be sure they are close enough for our pur poses, we need to make sure
that they are not the same every time. That is why we start with a 
Ran 
dom 
ize
statement. Just put this somewhere where it will be run before you need any ran -
dom numbers (such as in your 
Ini 
tial 
ize
pro cedure). Imagine that the com-
puter has a big deck of cards with num bers on them. When you ask for a ran dom
number, it picks the first card off the top of the deck and gives you the num ber on 
it. When you ask for an other random number, it picks the next card. This deck of
cards starts out in the same or der every time, so ev ery time you start the presenta-
tion and ask for a bunch of cards, you will get the same cards. This isn’t very
good. What we need is to shuffle the cards.

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   144   145   146   147   148   149   150   151   ...   191




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