Quiz

G

Guest

Hi,
I have looked around for quiz and found some very good ones, for example one
from Shyam Pillai (the file pptQuiz.ppt), but I want it a little bit
different.

Those I have found use VBA and have the questions in the code. Is it
possible to have all the questions/answers on the last slide(s) and use VBA
to pick up the questions/answers? In that way users can type in their
questions/answers themself instead of changing the VBA-code.

/ Ulf
 
T

Tim Hards

Hi Ulf,

To extend Shyam Pillai's pptQuiz (http://skp.mvps.org/ppt00031.htm),
you can do the following. After you do this, all of the questions and
answers will be picked up from the slides instead of the code.

Using the code I have given, the questions and answers will need to be
stored in a specific format:

- create a blank slide for each question

- make the slide hidden

- add a text box to the slide (this must be the only thing on the
slide, excluding any items on the master slide)

- in the text box, type a question followed by the 3 possible answers,
using a separate line for each of these

- select the line with the correct answer and make that line bold

Repeat this for each question that you want to use.


Now for the code changes. Edit the VBA and do these things:

1.
So that we can have a flexible number of questions, change this line:
Const NOOFQS = 3
to:
Dim NOOFQS As Integer

2.
In "Sub BeginQuiz()"
replace everything from
ReDim Qs(NOOFQS)
to (and including)
Ans(2) = 1
with this single statement (to call a function that I'll give in a
moment):
GetValues

3.
The Choices array needs to have it's dimensions swapped over so that
we can use "ReDim Preserve" to extend the array, so replace:
.Shapes("Choice1").TextFrame.TextRange.Text = Choices(QNo - 1,
0)
.Shapes("Choice2").TextFrame.TextRange.Text = Choices(QNo - 1,
1)
.Shapes("Choice3").TextFrame.TextRange.Text = Choices(QNo - 1,
2)
With:
.Shapes("Choice1").TextFrame.TextRange.Text = Choices(0, QNo -
1)
.Shapes("Choice2").TextFrame.TextRange.Text = Choices(1, QNo -
1)
.Shapes("Choice3").TextFrame.TextRange.Text = Choices(2, QNo -
1)

and replace:
AnsList = AnsList & Qs(X) & vbTab & " Answer:" & Choices(X,
Ans(X)) & vbCrLf
with:
AnsList = AnsList & Qs(X) & vbTab & " Answer:" & Choices(Ans(X),
X) & vbCrLf

4.
Finally, you will need to add the code to read the questions and
answers from the slides.

If I post the code here, it will get distorted with line breaks, so
instead I've put in in my blog, where you'll be able to copy'n'paste
it: http://timhards.com/2005/09/29/powerpoint-quiz/


I hope this helps you,

--
Tim Hards
http://timhards.com/

Chief Software Architect
Perspector - 3D Business Graphics for PowerPoint
http://perspector.com/
 
D

David M. Marcovitz

I have several examples on my Web site. Many of them do not require any
change in the VBA code. However, I do not have any examples on my site
that generate the slides from a text file or another slide. That wouldn't
be too hard to do, however. If you look at Example 7.9 on my site, you
can see how you can create a slide and buttons with VBA (even buttons
that run VBA procedures). It wouldn't be too difficult to use that same
technique to read the information that needs to go onto a slide from a
slide.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top