Log in

View Full Version : POWERPOINT QUIZ, CODE TO SEND RESULTS AUTOMATICALLY



Gabrielle
10-05-2014, 02:21 AM
Hi all
I've an elderly lady who has just designed my first very simple powerpoint quiz, but I'm stuck andneed the code to send the results to an email address. Any help would be greatly appreciated (in words of one syllable, please!). I have attached my code so far below
Many thanks



Dim UserName As String
Dim numberCorrect As Integer
Dim numberWrong As Integer

Sub YourName()
UserName = InputBox(Prompt:="Pleae type your first name!")
MsgBox " Welcome to The Wolverhampton Induction Quiz " + UserName, vbApplicationModal, " Trial Quiz"
End Sub

Sub Correct()
MsgBox "Well Done! That's the correct answer " + UserName, vbApplicationModal, " Trial Quiz"
numberCorrect = numberCorrect + 1
ActivePresentation.SlideShowWindow.View.Next
End Sub

Sub Wrong()
MsgBox "Sorry! That's incorrect " + UserName, vbApplicationModal, " Trial Quiz"
numberWrong = numberWrong + 1
ActivePresentation.SlideShowWindow.View.Next
End Sub

Sub Start()
numberCorrect = 0
numberWrong = 0
YourName
ActivePresentation.SlideShowWindow.View.Next
End Sub

Sub Results()
MsgBox "Well done " & UserName & " You scored " & numberCorrect & " out of " & numberCorrect + numberWrong, vbApplicationModal, " Trial Quiz"
ActivePresentation.SlideShowWindow.View.Next
End Sub

Paul_Hossler
11-01-2019, 07:21 PM
Welcome to the forum - please take a minute to look at the FAQs in the link in my signature below

I added CODE tags to your macros -- it sets them off and does some formatting


So ...

I created a simple PP mock up with you code so I could test (that's in one module).

Also tweaked some to give you some simple ideas

The main thing is adding email subroutine in another module and tying it into the Results sub



Sub Results()
Dim bSuccess As Boolean

ShowMessage "Well done " & UserName & vbCrLf & vbCrLf & "You scored " & numberCorrect & " out of " & (numberCorrect + numberWrong)

' the ^ is just a special marker in my code to make a carriage return in the text
bSuccess = SendWithOutlook("YOURNAME@WHERE.COM", _
"Test Results for " & UserName, _
UserName & " got:" & _
"^^ Number Correct " & numberCorrect & _
"^^ Number Incorrect " & numberWrong)

ActivePresentation.SlideShowWindow.View.Next
End Sub



Feel free to ask quesions

John Wilson
11-02-2019, 03:12 AM
The actual post seems to be 5 years old Paul.

Paul_Hossler
11-02-2019, 06:24 AM
:doh::doh::doh:

Someone added #2 yesterday and that moved the thread to the top of the pile.

I never thought to check the date on the original

At least it was a simple request and didn't take much time

John Wilson
11-02-2019, 11:50 AM
Yep, but the second poster is just linking to a fake essay site.