Consulting

Results 1 to 4 of 4

Thread: Macro for multichoice question

  1. #1
    VBAX Regular
    Joined
    Apr 2012
    Posts
    22
    Location

    Macro for multichoice question

    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.
    Attached Files Attached Files
    • File Type: zip a.zip (89.7 KB, 19 views)

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    [VBA]
    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

    [/VBA]

    Paul

  3. #3
    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..

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    probably something like this. The reason I didn't do that was because your message said 'Please try again'


    [VBA]

    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


    [/VBA]

    Paul

Posting Permissions

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