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


Download 1.37 Mb.
Pdf ko'rish
bet96/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   92   93   94   95   96   97   98   99   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Ini 
tial 
ize
pro cedure. We would also need
the pro ce dures
RightAnswer3
and 
WrongAnswer3
, just like 
RightAnswer1
and 
WrongAnswer1
(ex cept us ing
q3Answered
in stead of 
q1Answered
). Then we
would need a procedure to ask a question and judge the an swer:
Sub Question3()
Dim an 
swer
answer = InputBox(Prompt:="What is the cap 
ital of Mary 
land?", _
Ti 
tle:="Question 3")
If an 
swer = "Annapolis" Then
RightAnswer3
Else
WrongAnswer3
End If
End Sub
Short-Answer Quiz Ques tions 99


This procedure uses the variable
an 
swer
to store the an swer typed by the
student. Because only this pro cedure needs to know about it, it can be de clared
in side the pro ce dure (
Dim an 
swer
). Next, we use
InputBox
, just like in the
YourName
pro cedure, to ask the student to type the an swer, which is stored in
the variable
an 
swer
.
In our multiple-choice ques tions, but tons were tied to our 
RightAnswer
and
WrongAnswer
pro cedures. With a short-answer question, we don’t have
buttons to call these pro cedures, so we use an
If
state ment. If the an swer is right, 
call the ap pro pri ate 
RightAnswer
pro cedure; if the answer is wrong, call the
ap pro pri ate
WrongAnswer
procedure.
The last thing you need is a way for the question to be asked. Fig ure 7.3
shows an ex 
ample slide. Just con 
nect the “Click to an 
swer” but 
ton to the

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   92   93   94   95   96   97   98   99   ...   191




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