PDA

View Full Version : Solved: Display response as answer



NeilM
01-06-2007, 07:22 AM
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

JonPeltier
01-06-2007, 08:49 PM
How do you want to display the answer?

' 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

NeilM
01-07-2007, 03:45 PM
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


JonPeltier
01-08-2007, 04:42 AM
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).

peterwmartin
01-10-2007, 08:44 AM
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.

NeilM
01-11-2007, 04:53 PM
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

NeilM
01-11-2007, 04:59 PM
Hi JonPeltier

Thanks for your help it works now

Regards
:biggrin:
Neil

Brandtrock
01-11-2007, 05:27 PM
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,

peterwmartin
01-12-2007, 01:06 PM
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.
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

NeilM
02-04-2007, 03:38 PM
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!

NeilM
02-04-2007, 03:40 PM
Thanks for the tip will endeavour to follow these rules.

Regards

Neil

peterwmartin
02-05-2007, 12:00 PM
Your welcome Neil, glad to see I could help for a change.