Bill:
You are absolutely right about avoiding programming keywords. As soon as I
saw it was, I knew it had to be changed. I used the Public statement because
the VBA Help states :
"Variables declared using the Public statement are available to all
procedures in all modules in all applications unless Option Private Module is
in effect; in which case, the variables are public only within the project in
which they reside."
I tried changing the variable name and still get the reset at each slide and
the last slide has the variables empty. The code for each slide, with the
only difference being which answer is set to True is:
Private Sub Slide18_Click()
intAnswerCnt = 0 'Resets intAnswerCnt to zero for beginning of test
PercentCorrect = 0 'Resets PercentCorrect to zero for beginning of test
If Title = True Then
intAnswerCnt = intAnswerCnt + 1 'Increases the question count by one
PercentCorrect = PercentCorrect + 1 'Increases the correct answer
count by one
Msg = "Correct! The correct Short Title is RIID Operator" 'Displays
the message
Response = MsgBox(Msg, vbInformation + vbOKOnly, "Correct Answer")
'Title of the message box
Response = MsgBox(PercentCorrect & ":" & intAnswerCnt,
vbInformation, "Numbers") 'Test Box to track variable values
SlideShowWindows(1).View.Next 'Moves to the next slide
Else
intAnswerCnt = intAnswerCnt + 1 'Increases the question count by one
Msg = "Incorrect. The Short Title is RIID Operator not RIID"
'Displays the message
Response = MsgBox(Msg, vbExclamation + vbOKOnly, "Incorrect Answer")
'Title of the message box
Response = MsgBox(PercentCorrect & ":" & intAnswerCnt,
vbInformation, "Numbers") 'Test Box to track numbers
SlideShowWindows(1).View.Next 'Moves to the next slide
End If 'End Block If Statement
End Sub
"Bill Dilworth" wrote:
> As a general rule, it is a good idea to avoid programming keywords. While I
> did not have any issue with a small routine I whipped up that used the
> variable name Count, it is possible. Try changing the Count variable to
> intAnswerCnt (make sure you use whole word replace). It may help.
>
> Possible also is that the variable is being changed by something in the code
> that you forgot about.
>
> Why are you declaring the variables as Public? It may be possible that you
> are running into a conflict with another routine.
>
>
> --
> Bill Dilworth
> A proud member of the Microsoft PPT MVP Team
> Users helping fellow users.
> billdilworth.mvps.org
> -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> yahoo2@ Please read the PowerPoint
> yahoo. FAQ pages. They answer most
> com of our questions.
> www.pptfaq.com
> ..
> ..
> "Chris" <(E-Mail Removed)> wrote in message
> news:2A128DDB-AC67-475B-B13D-(E-Mail Removed)...
> > Hi to All.
> >
> > I am trying to create a "test" at the end of a presentation. I need to be
> > able to count the number of questions answered and the number of correct
> > answers. The last slide will be a presentation of a certificate with the
> > user's name and their results to be printed.
> >
> > The two things that are not working are the counting of the variable and
> > placing the results into a textbox on the last slide as soon as the slide
> > is
> > presented. The format is Scenario 1, 2 slides choosing an answer,
> > Scenario
> > 2, 2 slides of choosing an answer, Scenario 3, 2 slides choosing an
> > answer,
> > then Four Scenarios each followed by one slide choosing an answer. The
> > choices are in an OptionButton Group unique for each slide.
> > First, I must tell you I am using PowerPoint 2000 for this.
> > The variables I have declared are:
> > Public Answer As String
> > Public Count, PercentCorrect As Integer
> >
> > From reading some of the posts here and PPT Help, I think I will have to
> > change the variable Count to something else. However, when I run the
> > script,
> > the variable will change between the first two slides but reset on each
> > slide
> > after that.
> >
> > The code I use to increase count is
> >
> > Count = Count +1
> > PercentCorrect = PercentCorrect + 1 (0 for incorrect answers)
> >
> > Thanks to all for any and all help.
>
>
>