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


Download 1.37 Mb.
Pdf ko'rish
bet121/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   117   118   119   120   121   122   123   124   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

tem?")
Loop While an 
swer <> "9"
Do While count < 3
an 
swer = InputBox("What do you like to eat?")
count = count + 1
Loop
122 More Tricks for Your Scripting Bag


Do Un 
til count >= 3
an 
swer = InputBox("What do you like to eat?")
count = count + 1
Loop
In the first example, the loop will run at least once and ask the ques tion: How
many planets are in the solar system? After running the loop once, it will check to
see if 
an 
swer
is 9. If it is, it will stop. If it is n’t, it will loop un til the answer is 9.
In the second ex ample, the loop will run at least once and ask the ques tion:
How many planets are in the solar system? After running the loop once, it will
check to see whether
an 
swer
is not 9. It will keep loop ing while the answer is
not 9. Note, this works ex actly the same as the first ex ample, but some times it is
easier to ask a pos itive question than a neg ative question, particularly if the ques -
tion has many parts with
And
and 
Or
.
In the third and fourth ex amples the condition will be checked be fore the
loop runs. In the third ex ample, the loop will only run if 
count
is less than 3, and
it will keep loop ing while
count
is less than 3. In the fourth ex ample, the loop
will stop run ning if 
count
is greater than or equal to 3, and it will keep loop ing
un til
count
is greater than or equal to 3. Like the first two ex amples, these ex -
amples have ex actly the same re sults, but some times it is eas ier to ask a positive
question, and sometimes it is easier to ask a negative question.

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   117   118   119   120   121   122   123   124   ...   191




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