EliseFreedman
Programmer
Hi There
I have created a powerpoint quiz as part of an elearning module. At the end of the result I was trying to create a results slide including the persons name and quiz result.
I am using the following code
I have attached the macro to a button using the hyperlink, mouseclick but when I click the button nothing happens at all. Can anyone suggest what I am doing wrong
The code is as follows
I have created a powerpoint quiz as part of an elearning module. At the end of the result I was trying to create a results slide including the persons name and quiz result.
I am using the following code
I have attached the macro to a button using the hyperlink, mouseclick but when I click the button nothing happens at all. Can anyone suggest what I am doing wrong
The code is as follows
Code:
Sub PrintablePage()
Dim printableSlide As Slide
Dim homeButton As Shape
Dim printButton As Shape
Set printableSlide = _
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
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) & _
"You got " & numCorrect & " out of " & _
numCorrect + numIncorrect & "." & Chr$(13) & _
"Press the Print Results button to print your answers."
Set homeButton = _
ActivePresentation.Slides(printableSlideNum).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(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 200, 0, 150, 50)
printButton.TextFrame.TextRange.Text = "Print Results"
printButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printButton.ActionSettings(ppMouseClick).Run = "PrintResults"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True
End Sub
Sub PrintResults()
ActivePresentation.PrintOptions.OutputType = ppPrintOutputSlides
ActivePresentation.PrintOut From:=printableSlideNum, _
To:=printableSlideNum
End Sub
Sub StartAgain()
ActivePresentation.SlideShowWindow.View.GotoSlide 1
ActivePresentation.Slides(printableSlideNum).Delete
ActivePresentation.Saved = True
End Sub