Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making a simple quiz in powerpoint

Status
Not open for further replies.

dnky

Technical User
Sep 11, 2003
21
GB
I've been pondering this one all day and thought i'd see if anyone else can help.

I'm making an interactive book in powerpoint and i want a quiz at the end. Each question will have it's own slide and 4 answers to choose from. After deciding that creating an access database using a form for each question was beyond my programming knowledge (i got stuck when i was trying to make the order of the multiple choices random), i decided to go for a simple counter system where only one of the four buttons on each slide would add 1 to the counter.

Is such programming possible in powerpoint? I need somewhere to store the value for "count", but once the macro is finished the value disappears.

My last resort is to run the whole quiz through one single macro, each question asked using the "inputbox" command, but it would be nice to use slides with pictures.

Any suggestions/directions would be appreciated. [thumbsup2]
 
Hi dnky,

You are going to need a repository for your answers. That could be a database like Access or Excel or it could be a text file.

If you use a database, just set up the table.

Use an INSERT sql to record the answers.

If it a text file you choose, you would write or input records.

Hope this gives you some good options. :)

Skip,
Skip@TheOfficeExperts.com
 
Greetings, Dinky --

Your project sounds very similar to one I have tackled.... Adn I'm stymied at a different level.

I've done many macros in Excel and Word, but this is my first attempt at automating a PowerPoint show.

I tried using CheckBoxes, and OptionButtons as Controls for the user to record their selection to multiple choice and T/F questions, respectively.

Every variation of code I have tried to intialize, or evaluate those selections and increment a counter, has run into either "Method or Data Member not found" errors, or "Error 91, Object Variable or With Block not set".

I would be happy to exchange samples of the ways we ahve tackled things...(as if you could care for my non-functional approach!) Any advice on evaluating Controls? I suspect its an absurdly simple thing!

Thanks --
Mike.Fiedler@OldcastlePrecast.com ::)
 
Hello,

in the end i used a text file to store the count. I made a seperate page for each question and set each page so that you could only continue by pressing one of the buttons (i.e. no advance slide setting)

then i made 4 macros. One to start the quiz, one for a right answer, one for a wrong answer, and the end result.

I then assigned the appropriate macro to each button.

simple but then i'm no VBA expert, i learned all the stuff on this forum actually! I hope this is of some use.

Sub preQuiz()
' prepares the text file
Dim strFile As String
strFile = "C:\tempcounter.txt"
Open strFile For Output As #1
Write #1, 0

Close #1
SlideShowWindows(1).View.Next

End Sub

Sub Quizcount1()
' + 1 to the text file and goes to next slide
Dim strFile As String
Dim countervalue As Integer
strFile = "C:\tempcounter.txt"

Open strFile For Input As #1
Input #1, countervalue
Close #1

countervalue = countervalue + 1

Open strFile For Output As #2
Write #2, countervalue
Close #2
SlideShowWindows(1).View.Next

End Sub

Sub Quizcount2()
' just goes to next slide
SlideShowWindows(1).View.Next

End Sub

Sub postQuiz()
' shows the result
Dim strFile As String
Dim countervalue As Integer
strFile = "C:\tempcounter.txt"

Open strFile For Input As #1
Input #1, countervalue
Close #1

totalvalue = "15"
percentage = countervalue / totalvalue

Message = MsgBox("You scored " & countervalue & " out of " & totalvalue & " (" & Format(percentage, "00%") & ")", vbOKOnly, "Result")
Kill "C:\tempcounter.txt"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top