This is where a variable's scope comes into play.
In the VBA Help section, look-up ...
{tab} Contents | Visual Basic Conceptual Topics | Declaring Variables
The help topic boils down to "where you declare the variable, defines when
it will be cleared."
Declare within a sub and it will clear at the end of the sub.
Declare outside the sub, in the module and it will be available in all the
subs (within that module), and will clear at the end of the module (file
end).
--
Bill Dilworth, Microsoft PPT MVP
===============
Please spend a few minutes checking vestprog2@
out
www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.
Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
David Marcovitz said:
Put the declaration at the beginning of your module, not at the beginning
of your procedure (sub). For example:
Dim grade
Sub Initialize ()
grade = 0
End Sub
Sub RightAnswer ()
grade = grade + 20
End Sub
Sub DisplayScore ()
MsgBox "Your score is " & grade & "."
End Sub
Link a button on your first slide to Initialize. Link the buttons to any
right answers to RightAnswer, and link a button on your last slide to
DisplayScore. As long as the Dim is the first thing in the module, all
procedures (and all slides) will know about it. I have lots of examples
like this in my book Powerful PowerPoint for Educators. It is due to be
released any day and can be ordered from amazon.com or bn.com.