Consulting

Results 1 to 12 of 12

Thread: Solved: Display response as answer

  1. #1
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location

    Solved: Display response as answer

    I have created a PowerPoint quiz one of the questions being "How many bits in a byte?" At the end of the quiz a summary slide is generated showing the student's answers.

    I am unsure how to display the response from an input box so as you can see in the code below on my reporting slide I am displaying what the answer should have been (this is on the fourth line - answer3 = "There are 8 bits in a byte"". Any ideas on how to display the actual response which might be, for example 7?

    Sub WrongAnswer3()
    If q3Answered = False Then
    numIncorrect = numIncorrect + 1
    answer3 = "There are 8 bits in a byte"
    End If
    q3Answered = True
    Rubbish
    ActivePresentation.SlideShowWindow.View.Next
    End Sub

  2. #2
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    How do you want to display the answer?

    [vba] ' get the answer
    MyAnswer = InputBox("What's the frequency, Kenneth?")

    ' display in message box
    MsgBox "The frequency is " & MyAnswer

    ' display in a shape
    ActivePresentation.Slides(1).Shapes("Rectangle 4").TextFrame.TextRange.Text = _
    "The frequency is " & MyAnswer
    [/vba]
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  3. #3
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location

    Display Response

    Hi Jon

    Thanks for your advice I'm trying to get the answer to display on a summary/results slide something like the following:

    YOUR ANSWERS:
    Question 1: X
    Question 2: 74
    Question 3: CD-ROM
    Question 4: 8

    So that the student can see a summary of a quiz he/she has just taken. Any ideas?

    Thanks

    Neil


  4. #4
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    You just have to keep track of the responses (use an array variable), construct the summary at the end, and place it into a textbox or other shape (I used a rectangle, which can be formatted to stand out on the slide).
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  5. #5
    Hi Neil,
    I have a presentation in which I use the office assistant to ask a question and then depending on the response will go to 1 of 3 slides. The questions are in the assistants bubble and you click on the answer. You maybe able to work with the assistant and tally up the answers at the end.

  6. #6
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location

    Office Assistant

    Hi Peter

    I had not heard of using the office assistant before, I've had an unsuccessful attempt (below) - any ideas. Thanks for your help

    Regards

    Neil

    Sub Question5()
    With Assistant.NewBalloon
    .BalloonType = msoBalloonTypeButtons
    .Heading = "Which of these is a Peripheral device?"
    .Text = "Select your answer"
    .Checkboxes(1).Text = "Windows XP"
    .Checkboxes(2).Text = "Motherboard"
    .Checkboxes(3).Text = "Memory Card"
    .Checkboxes(4).Text = "Keyboard"
    .Button = msoButtonSetOkCancel
    .Show
    For i = 1 To 4
    .Checkboxes(i).Text = "Region " & i
    Next
    If .Checkboxes(1).Checked Then
    ans5
    End If
    If .Checkboxes(2).Checked Then
    ans5
    End If
    If .Checkboxes(3).Checked Then
    ans5
    If .Checkboxes(4).Checked Then
    ans5
    End If
    End With
    End Sub
    Sub ans5()
    If .Checkboxes(1).Checked Then
    numIncorrect = numIncorrect + 1
    answer5 = "Windows XP"
    Rubbish
    ActivePresentation.SlideShowWindow.View.Next
    End If
    If .Checkboxes(2).Checked Then
    numIncorrect = numIncorrect + 1
    answer5 = "Motherboard"
    Rubbish
    ActivePresentation.SlideShowWindow.View.Next
    End If
    If .Checkboxes(3).Checked Then
    numIncorrect = numIncorrect + 1
    answer5 = "Memory Card"
    Rubbish
    ActivePresentation.SlideShowWindow.View.Next
    If .Checkboxes(4).Checked Then
    numCorrect = numCorrect + 1
    answer5 = "Keyboard"
    WellDone
    ActivePresentation.SlideShowWindow.View.Next
    End If
    End Sub

  7. #7
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location
    Hi JonPeltier

    Thanks for your help it works now

    Regards

    Neil

  8. #8
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Neil,

    Glad to see that you got an answer. In the future, please use th code tags (the # sign above the box you type your reply in). They will format your code like the VBIDE

    Regards,
    Brandtrock




  9. #9
    Hi Neil, No I am not yet smart enough to work out your code maybe someone else may be able to help. However this bit of code did work for me. Sorry I could not attatch the slide show and I needed to delete parts of the questions to post it. It is work related material. Hope it helps.
    [VBA]Sub showass() 'show assistant
    Assistant.Visible = True
    Assistant.Move xleft:=500, ytop:=400
    Set b = Assistant.NewBalloon
    With b
    .Heading = "If the material is off centre to the drive side you would"
    .Text = "Select one of these things:"
    .Labels(1).Text = "Move the to the side at the unit."
    .Labels(2).Text = "Move the to the drive side at the inline fife."
    .Labels(3).Text = "Move the to the Operator side."
    returnValue = .Show
    End With
    Select Case returnValue
    Case 1
    ActivePresentation.SlideShowWindow.View.GotoSlide (2)
    Case 2
    ActivePresentation.SlideShowWindow.View.GotoSlide (3)
    Case 3
    ActivePresentation.SlideShowWindow.View.GotoSlide (4)
    End Select
    End Sub
    [/VBA]

  10. #10
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location

    Smile Office Assistant

    Thanks Peter your help has enabled me to work it out, sorry about the delayed response my computer has been down for about three weeks awaiting repair under warranty!

  11. #11
    VBAX Regular
    Joined
    Dec 2006
    Posts
    9
    Location
    Thanks for the tip will endeavour to follow these rules.

    Regards

    Neil

  12. #12
    Your welcome Neil, glad to see I could help for a change.

Posting Permissions

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