PDA

View Full Version : Macro for multichoice question



cruise
05-14-2012, 11:51 AM
Dear friends,
I am very new to the VBA. I want to prepare 80 slides for an exam where for each slide, four multichoice question will be there. Finally I want to get the score of the student out of total.
I prepare three slides. if the student select the wrong answer, also the slide will scroll forward (which is not happening here). Can anybody help me
How to keep the bullet button replacing the rectangle. Please don't mind I am asking silly question as I don't know.

Paul_Hossler
05-14-2012, 03:28 PM
Option Explicit

'http://skp.mvps.org/ppt00030.htm

Dim cScope As Long, cScore As Long

Sub Wrong()
MsgBox ("Sorry, that’s not right. Please try again.")
End Sub


Sub Right()
MsgBox ("That’s right!")
cScope = cScope + 7
cScore = cScore + 1

If ActivePresentation.SlideShowWindow.View.Slide.SlideIndex < ActivePresentation.Slides.Count Then
SlideShowWindows(1).View.Next
Else
MsgBox ("Congratulations!")
MsgBox "Your score is " & cScore
SlideShowWindows(1).View.Exit
End If

End Sub



Paul

abraham30
05-15-2012, 10:55 AM
thanks paul for your great help.
One simple query.
when the question is wrong, the slide get sticked and not move. What I want is that although it is wrong, the slide will be forwarded automatically to the next one.
Finally the result output will be displayed..

Paul_Hossler
05-20-2012, 01:05 PM
probably something like this. The reason I didn't do that was because your message said 'Please try again'





Sub Wrong()
MsgBox ("Sorry, that’s not right. Please try again.")

If ActivePresentation.SlideShowWindow.View.Slide.SlideIndex < ActivePresentation.Slides.Count Then
SlideShowWindows(1).View.Next
Else
MsgBox ("Congratulations!")
MsgBox "Your score is " & cScore
SlideShowWindows(1).View.Exit
End If

End Sub




Paul