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


MsgBox for feedback, ty ing your but tons with right and wrong an swers to the fol low ing pro ce dures, re spec tively: Sub RightAnswer()


Download 1.37 Mb.
Pdf ko'rish
bet87/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   83   84   85   86   87   88   89   90   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

MsgBox
for feedback, ty ing your but tons with right and
wrong an swers to the fol low ing pro ce dures, re spec tively:
Sub RightAnswer()
MsgBox ("Good job.")
End Sub
Sub WrongAnswer()
MsgBox ("Try to do better.")
End Sub
With a lit tle help from Chap ter 5, you can include the user’s name in your
feed back:
Dim userName
Sub YourName()
userName = InputBox(prompt:="What is your name?")
End Sub
Sub RightAnswer()
MsgBox ("Good job, " & userName)
End Sub
Sub WrongAnswer()
MsgBox ("Try to do better, " & userName)
End Sub
Next, add a lit tle bit of help from Chap ter 6 to au tomatically jump to the
next question after the right an swer is chosen:
Sub RightAnswer()
MsgBox ("Good job, " & userName)
ActivePresentation.SlideShowWindow.View.Next
End Sub
As usual, with a small amount of VBA, we have added a small amount of
power: add ing the user’s name to the feedback and cut ting down on the num ber
of slides. These are small advantages over tra ditional PowerPoint. In the next
section, we’ll add more power by keep ing score.
92 Quizzes and Tests


Keep ing Score
If you create a test with the above procedures at tached to the right and
wrong answers, you don’t have to change your slides or but tons at all to add
scorekeeping; you just need some small ad ditions to your VBA. Fig ure 7.1
shows the slides for a simple test along with the VBA code that gives feedback
and keeps score. The arrows show which but tons are tied to which procedures.
Figure 7.1. Mul tiple-Choice Test with Scorekeeping
Although this ex ample only has two ques tions, and each question has two
possible answers, this easily can be ex panded to in clude more ques tions and
more possible answers. In fact, the VBA script re mains exactly the same. You
simply add more slides and tie the but 
tons to the

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   83   84   85   86   87   88   89   90   ...   191




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