Consulting

Results 1 to 5 of 5

Thread: POWERPOINT QUIZ, CODE TO SEND RESULTS AUTOMATICALLY

  1. #1

    POWERPOINT QUIZ, CODE TO SEND RESULTS AUTOMATICALLY

    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
    Last edited by Paul_Hossler; 11-01-2019 at 07:21 PM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    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
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    The actual post seems to be 5 years old Paul.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location


    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
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Yep, but the second poster is just linking to a fake essay site.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •