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


Download 1.37 Mb.
Pdf ko'rish
bet91/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   87   88   89   90   91   92   93   94   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Sub RightAnswer()
If qAnswered = False Then 'ADDED
numCorrect = numCorrect + 1
End If 'ADDED
qAnswered = False 'ADDED
DoingWell
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub DoingWell()
MsgBox ("You are do 
ing well, " & userName)
End Sub
Sub WrongAnswer()
If qAnswered = False Then 'ADDED
numIncorrect = numIncorrect + 1
End If 'ADDED
qAnswered = True 'ADDED
DoingPoorly
'DELETED ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub DoingPoorly()
MsgBox ("Try to do better next time, " & userName)
End Sub
Sub Feed 
back()
MsgBox ("You got " & numCorrect & " out of " _
& numCorrect + numIncorrect & ", " & userName)
End Sub
The heart of this pro cedure is the variable
qAnswered
. It keeps track of
whether or not the current question has been answered yet. If it is 
False
, the ques-
tion has not yet been an swered; if it is
True
, the question has been answered.
A small amount of code is added to the 
Dim
sec tion to declare
qAnswered
so that all the pro cedures know about it. It also must be in itialized to 
False
in
the
Initialize
pro cedure so it is
False
when you get to the first question. Fi -
nally,
RightAnswer
and 
WrongAnswer
must check and ad just the value of
qAnswered
.
RightAnswer
and 
WrongAnswer
check to see if the question has not been
answered yet
If
(
qAnswered = False) Then
and only add one to

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   87   88   89   90   91   92   93   94   ...   191




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