Dim numCorrect As Integer
Dim numIncorrect As Integer
Dim userName As String
Dim answer1 As String
Dim answer2 As String
Dim answer3 As String
Dim answer4 As String
Dim printableslidenum As Long
Sub GetStarted()
Initialize
YourName
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub Initialize()
numCorrect = 0
numIncorrect = 0
printableslidenum = ActivePresentation.Slides.Count + 1
End Sub
Sub YourName()
userName = InputBox(prompt:="Please enter first and last name?")
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub DoingWell()
MsgBox ("Good job!, " & userName)
ActivePresentation.SlideShowWindow.View.Next
End Sub
Sub TryAgain()
MsgBox ("Please try again, " & userName)
End Sub
Sub Answer1AllofAbove()
If q1Answered = True Then
numCorrect = numCorrect + 1
answer1 = "All of the Above"
End If
q1Answered = True
DoingWell
End Sub
Sub Answer2Three()
If q2Answered = True Then
numCorrect = numCorrect + 1
answer2 = "Three"
End If
q2Answered = True
DoingWell
End Sub
Sub Answer3False()
If q3Answered = False Then
numCorrect = numCorrect + 1
answer3 = "False"
End If
q3Answered = False
DoingWell
End Sub
Sub Answered4AthroughCabove()
If q4Answered = True Then
numCorrect = numCorrect + 1
answer4 = "A through C above"
End If
q4Answered = True
DoingWell
End Sub
Sub PrintablePage()
Dim printableSlide As Slide
Dim homebutton As Shape
Dim printbutton As Shape
Set printableSlide = ActivePresentation.Slides.Add(Index:=6, _
Layout:=ppLayoutText)
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Results for " & userName
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"Your answers" & Chr$(13) & _
"Question 1: " & answer1 & Chr$(13) & _
"Question 2: " & answer2 & Chr$(13) & _
"Question 3: " & answer3 & Chr$(13) & _
"Question 4: " & answer4 & Chr$(13) & _
"Press the Print Results button to print your answers."
Set homebutton = ActivePresentation.Slides(6).Shapes.AddShape _
(msoShapeActionButtonCustom, 0, 0, 150, 50)
homebutton.TextFrame.TextRange.Text = "Start Again"
homebutton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
homebutton.ActionSettings(ppMouseClick).Run = "Startagain"
Set printbutton = ActivePresentation.Slides(6).Shapes.AddShape _
(msoShapeActionButtonCustom, 200, 0, 150, 50)
printbutton.TextFrame.TextRange.Text = "Print Results"
printbutton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printbutton.ActionSettings(ppMouseClick).Run = "Print Results"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True
End Sub
Sub Printresults()
ActivePresentation.PrintOptions.OutputType = ppPrintOutputSlides
ActivePresentation.PrintOut from:=6, to:=6
End Sub
Sub StartAgain()
ActivePresentation.SlideShowWindow.View.GotoSlide (1) 'keep getting runtime error here
ActivePresentation.Slides(6).Delete
ActivePresentation.Saved = True
End Sub