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


Download 1.37 Mb.
Pdf ko'rish
bet101/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   97   98   99   100   101   102   103   104   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

End Sub
Sub DoingPoorly()
MsgBox ("Try to do better next time, " & userName)
End Sub
Sub Answer1GeorgeWashington()
If q1Answered = False Then
numCorrect = numCorrect + 1
answer1 = "George Wash 
ington" 'ADDED
End If
q1Answered = True
DoingWell
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Answer1AbrahamLincoln()
If q1Answered = False Then
numIncorrect = numIncorrect + 1
answer1 = "Abra 
ham Lin 
coln" 'ADDED
End If
q1Answered = True
DoingPoorly
End Sub
How Did You Do: Re porting Results to the Teacher 103


Sub Answer2Two()
If q2Answered = False Then
numCorrect = numCorrect + 1
answer2 = "2" 'ADDED
End If
q2Answered = True
DoingWell
ActivePresentation.SlideShowWindow.View.Next_End_Sub_Sub_Answer2Four()_If_q2Answered_=_False_Then_numIncorrect_=_numIncorrect_+_1'>ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Answer2Four()
If q2Answered = False Then
numIncorrect = numIncorrect + 1
answer2 = "4"
End If
q2Answered = True
DoingPoorly
End Sub
Sub Question3()
Dim an 
swer
answer = InputBox(Prompt:="What is the cap 
ital of Mary 
land?", _
Ti 
tle:="Question 3")
If q3Answered = False Then 'ADDED
answer3 = an 
swer 'ADDED
End If 'ADDED
answer = Trim(an 
swer)
answer = LCase(an 
swer)
If an 
swer = "annapolis" Then
RightAnswer3
Else
WrongAnswer3
End If
End Sub
Sub RightAnswer3()
If q3Answered = False Then
numCorrect = numCorrect + 1
End If
q3Answered = True
DoingWell
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub WrongAnswer3()
If q3Answered = False Then
numIncorrect = numIncorrect + 1
End If
q3Answered = True
DoingPoorly
End Sub
Sub PrintablePage() 'ADDED
Dim printableSlide As Slide
Dim homeButton As Shape
Dim printButton As Shape
104 Quizzes and Tests


Set printableSlide = _
ActivePresentation.Slides.Add(In 
dex:=printableSlideNum, _
Lay 
out:=ppLayoutText)
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Re 
sults for " & userName
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"Your An 
swers" & Chr$(13) & _
"Ques 
tion 1: " & answer1 & Chr$(13) & _
"Ques 
tion 2: " & answer2 & Chr$(13) & _
"Ques 
tion 3: " & answer3 & Chr$(13) & _
"You got " & numCorrect & " out of " & _
numCorrect + numIncorrect & "." & Chr$(13) & _
"Press the Print Re 
sults but 
ton to print your an 
swers."
Set homeButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 0, 0, 150, 50)
homeButton.TextFrame.TextRange.Text = "Start Again"
homeButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   97   98   99   100   101   102   103   104   ...   191




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