Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / December 2007

Tip: Looking for answers? Try searching our database.

Keeping score

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MoWoL - 11 Dec 2007 18:09 GMT
Many thanks to everyone who has helped me so far. I was hoping to once again
get pointed in the right direction. I have a power point for user practice
that gives the slides in random order, and when the question is answered
incorrectly, the slide will come up again, once correct, it no longer comes
up. This code was adapted from Mr. Marcovitz's web site and works beautifuly.
I have tried to incorporate scoring on the power point, and want it to only
count the answer the first time it comes up. (If they get it wrong once, it's
counted as wrong even though they will face the question again.) I have tried
using the qAnswered array found on the site, but it won't work. I think maybe
because I already have the visited array keeping the randomization working
properly. (Can you have two arrays in code?) I am new to VBA, but love
playing with it. The following code works but counts incorrect every time
they may get it wrong, not just the first. Thanks again for any input you may
have.

Dim visited() As Boolean
Dim numSlides As Long
Dim numRead As Integer
Dim NumCorrect As Integer
Dim NumIncorrect As Integer

Sub GetStarted()

   Initialize
   MakeAllNotVisible
   RandomNext

End Sub

Sub Initialize()

   Randomize
   numRead = 0
   NumCorrect = 0
   NumIncorrect = 0
   numSlides = ActivePresentation.Slides.Count
   ReDim visited(numSlides)
   For i = 2 To numSlides - 1
       visited(i) = False
   Next i
End Sub

Sub MakeAllNotVisible()

   Dim oSld As Slide
   Dim oShp As Shape
   For Each oSld In ActivePresentation.Slides
       For Each oShp In oSld.Shapes
           If oShp.Name = "Missed" Then
               oShp.Visible = False
           End If
       Next oShp
   Next oSld

End Sub
Sub RightAnswer()
   
   NumCorrect = NumCorrect + 1
   visited(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex) = True
   numRead = numRead + 1
   RandomNext

End Sub
Sub WrongAnswer()

   NumIncorrect = NumIncorrect + 1
   ActivePresentation.SlideShowWindow.View.Slide.Shapes("Missed").Visible =
True
  ActivePresentation.SlideShowWindow.View.GotoSlide (2)
       
End Sub
Sub RandomNext()
   Dim nextSlide As Long
   
   If numRead >= numSlides - 3 Then
       ActivePresentation.SlideShowWindow.View.Last
   Else
       nextSlide = Int((numSlides - 2) * Rnd + 2)
       While visited(nextSlide) = True Or nextSlide = 2
           nextSlide = Int((numSlides - 2) * Rnd + 2)
       Wend
          ActivePresentation.SlideShowWindow.View.GotoSlide (nextSlide)
   End If
End Sub
David M. Marcovitz - 11 Dec 2007 19:01 GMT
Within reason, you can have as many arrays as you want. Without testing
it out, I believe that what you want to do is VERY easy. Right now, you
are adding one to numCorrect or numIncorrect no matter what. All you need
to do is put those statements inside an If block to ask if that question
has been visited previously. It should be something like this (in
RightAnswer):

If visited(ActivePresentation.SlideShowWindow.View.Slide.SlideIndex) _
   = False Then
   numCorrect = numCorrect + 1
End If

Do the same for WrongAnswer (obviously using numIncorrect). The If
statement simply asks if the slide has not been visited. If it has, it
does nothing with the score. If it has not, it adds one to the count of
correct or incorrect answers.

--David
Signature

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.PowerfulPowerPoint.com/

> Many thanks to everyone who has helped me so far. I was hoping to once
> again get pointed in the right direction. I have a power point for
[quoted text clipped - 83 lines]
>     End If
> End Sub
MoWoL - 11 Dec 2007 19:58 GMT
Thank you for getting back to me so quickly. I have tried this and the
problem lies in WrongAnswer. When the user gets the question wrong the first
time it will count NumIncorrect. But in order to make the slide come up again
in the RandomNext, I can not then mark the slide as visited. So the next time
it comes up, if they again answer incorrectly, visited is still false so it
counts another incorrect. It also will then count one for correct the next
time because visited will be false until the correct answer is reached. Once
answered correctly, the slide doesn't come up anymore, so the issue ends, but
in this situation, it would have counted twice incorrect and once correct.

> Within reason, you can have as many arrays as you want. Without testing
> it out, I believe that what you want to do is VERY easy. Right now, you
[quoted text clipped - 102 lines]
> >     End If
> > End Sub
David M. Marcovitz - 11 Dec 2007 20:12 GMT
Aha. Now I get your issue. Sorry for misunderstanding the first time. In
this case, you need another array (that is why you were asking about the
number of arrays). Call it visited2 or something that makes sense to you.
Copy just about every line of code where you have visited and add one
just like it for visited2. Then use visited2 in my If statements and the
original visited in the Random statements. Make sure that you set
visited2 to True in WrongAnswer (and not visited) and both visited and
visited2 to True in Right Answer.
--David

Signature

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.PowerfulPowerPoint.com/

> Thank you for getting back to me so quickly. I have tried this and the
> problem lies in WrongAnswer. When the user gets the question wrong the
[quoted text clipped - 116 lines]
>> >     End If
>> > End Sub
MoWoL - 11 Dec 2007 21:22 GMT
Well thanks for the help. I had tried to do that before but it wasn't
working. Thats why I thought maybe you couldn't have more than one array. Now
I know, it was probably just something I missed in code. Like a stinking
comma or something. (Picky VBA) I will give it another shot. Thanks again for
all your help.

> Aha. Now I get your issue. Sorry for misunderstanding the first time. In
> this case, you need another array (that is why you were asking about the
[quoted text clipped - 126 lines]
> >> >     End If
> >> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.