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


Download 1.37 Mb.
Pdf ko'rish
bet144/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   140   141   142   143   144   145   146   147   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Ques 
tion
pro ce dure
for each question. That pro cedure will ask the ques tion, judge the answer, and
store the answer. When it fig ures out if the an swer was right or wrong, it will
call the
RightAnswer
or 
WrongAnswer
pro cedure. So we need the fol low-
ing pro ce dures:
• Each short-answer question needs its own 
Ques 
tion
pro ce dure
(
Question1
,
Question2
,
Question3
).
• All the multiple-choice ques tions need one 
RightAnswerButton
and one 
WrongAnswerButton
pro cedure, which will be tied to ev -
ery but ton with a right and wrong an swer, respectively.
• All the questions need one 
RightAnswer
and 
WrongAnswer
procedure, which is called from
RightAnswerButton
,
WrongAnswerButton
, and each 
Ques 
tion
pro ce dure.
Next, our 
Ques 
tion
pro cedures need a slight mod ification so they can
store the answer in the
an 
swer
ar 
ray. Here is an example procedure for
Question3
:
Sub Question3()
Dim theAnswer As String
Dim thisQuestionNum As Long
thisQuestionNum = _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex - 1
140 More Tricks for Your Scripting Bag


theAnswer = InputBox(Prompt:="What is the cap 
ital of Mary 
land?", _
Ti 
tle:="Question " & thisQuestionNum)
If qAnswered(thisQuestionNum) = False Then
an 
swer(thisQuestionNum) = theAnswer

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   140   141   142   143   144   145   146   147   ...   191




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