bungle000
11-17-2015, 04:03 PM
Hi there, please forgive me as I am a complete novice and trying my darned hardest to learn. I created a PowerPoint quiz using various snippets found with the help of the wonderful google. It has VBA behind it to store a users name and score and bring it all up in a final printable slide (see code below) what i now want to do, if it is at all possible, is to automatically store the data received within & firstname &, & lastname &, & numcorrect & into an excel database within a preset column on the next available row for example first name would go into the next available row on column A etc.
Like i said i dont know if this is at all possible and at the moment it seems my lucky streak with finding and compiling the information has run out.
below is the code for the printable slide, it may not be too tidy or professional (apologies ) but at the moment it works just fine
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 = _
"PPT Title "
printableSlide.Shapes(1).TextFrame.TextRange.Font.Size = 20
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"Results for " & firstname & " " & lastname & Chr$(13) & _
"PPT Title" & Chr$(13) & _
"You got " & numCorrect & " out of " & _
numCorrect + numIncorrect & "." & Chr$(13) & _
"If you got at least 5 correct, press the Print Results button to print your answers." & Chr$(13) & _
"If you did not get at least 5 correct, press the Start Again button."
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 18
Set homeButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 140, 380, 130, 30)
homeButton.TextFrame.TextRange.Text = "Start Again"
homeButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
homeButton.ActionSettings(ppMouseClick).Run = "StartAgain"
Set printButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 420, 380, 130, 30)
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
Like i said i dont know if this is at all possible and at the moment it seems my lucky streak with finding and compiling the information has run out.
below is the code for the printable slide, it may not be too tidy or professional (apologies ) but at the moment it works just fine
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 = _
"PPT Title "
printableSlide.Shapes(1).TextFrame.TextRange.Font.Size = 20
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"Results for " & firstname & " " & lastname & Chr$(13) & _
"PPT Title" & Chr$(13) & _
"You got " & numCorrect & " out of " & _
numCorrect + numIncorrect & "." & Chr$(13) & _
"If you got at least 5 correct, press the Print Results button to print your answers." & Chr$(13) & _
"If you did not get at least 5 correct, press the Start Again button."
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 18
Set homeButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 140, 380, 130, 30)
homeButton.TextFrame.TextRange.Text = "Start Again"
homeButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
homeButton.ActionSettings(ppMouseClick).Run = "StartAgain"
Set printButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 420, 380, 130, 30)
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