How to add a number during PPT?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is the scenario:
I want to interact with audience during the PPT. There are 2 variables
marked as A and B on all slides. I want to be able to increase the value of
A by 10 points by hitting a key (let say hitting F1) and increase the value
of B by 10 points by hitting a key (let say hitting F2). The numbers should
be updated when I move to the next slide, so that they represent the total
points.
Is this possible without using Excel?
Thanks for any help.
Dori
 
Something like this can be done with VBA. It's not Excel, but if you
haven't used VBA in PowerPoint, you might wish that it was.
--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.PowerfulPowerPoint.com/
 
Here is the scenario:
I want to interact with audience during the PPT. There are 2 variables
marked as A and B on all slides. I want to be able to increase the value of
A by 10 points by hitting a key (let say hitting F1) and increase the value
of B by 10 points by hitting a key (let say hitting F2).

Via keystrokes, not possible. But a vba macro could let you click on buttons
to change the values.
The numbers should
be updated when I move to the next slide, so that they represent the total
points.

Which numbers should be updated? It's not clear from this.

Would it be correct to say that you want a text box on Slide B to show the
updated total of the two numbers on slide A, assuming you go to A first, then
B?
 
Hi Dave,
What VBA do you recommend?
Thanks,
Dori

David M. Marcovitz said:
Something like this can be done with VBA. It's not Excel, but if you
haven't used VBA in PowerPoint, you might wish that it was.
--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.PowerfulPowerPoint.com/
 
Hi Steve,
Thanks for helping me out.
Let say on slide #1: I have a text box called "SCORE FOR GROUP A": The score
for Group A is zero to begin with. I want the score appear below the text box
of "SCORE FOR GROUP A". I want to have a dedicated action button for group A
so that every time that I click on it, it adds up 10 points to the score for
group A (i.e. A=A+10).
When I move to the next slide, I want to see the last score for group A from
previous slide and still be able to click the action button to add 10 points
to the score of group A until the show is over.
What VBA do you recommend.
Thank you,
Dori
 
Create a text box on a slide. Name it TheScoreBox (using the naming
procedure in Example 8.7 on my Web site). Create a button and link it to
the following procedure (this is all untested off the top of my head, but
it should get you started):

Dim theScore as Long

Sub IncreaseScore()
theScore = theScore + 10
ActivePresentation.Slides(2).Shapes("TheScoreBox") _
.TextFrame.TextRange.Text = theScore

End Sub

You might also want to have a procedure linked to a button on the first
slide:

Sub Initialize()
theScore = 0
ActivePresentation.Slides(2).Shapes("TheScoreBox") _
.TextFrame.TextRange.Text = theScore
End Sub

These procedures all assume that you have your score text box on slide 2.
If you want it to be a different slide, change the 2 (in Slides(2) ) to
another number. Also, if you want to have score boxes that have the same
score on other slides add identical lines in both procedures (that is,
repeat the two lines starting with ActivePresentation) and change the
number 2 to the numbers of the other slides that have score boxes (be
sure you also name those text boxes TheScoreBox.

Is this helpful? There are many examples that keep score on my Web site
(http://www.PowerfulPowerPoint.com/), but none of them do exactly what
you want. However, they might be helpful to get you to understand how
this all works.

--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.PowerfulPowerPoint.com/
 
Mind if I ladle on a bit more from top of head?
See below:

David M. said:
Create a text box on a slide. Name it TheScoreBox (using the naming
procedure in Example 8.7 on my Web site). Create a button and link it to
the following procedure (this is all untested off the top of my head, but
it should get you started):

Dim theScore as Long

Sub IncreaseScore()

' we'd need to pick up the previous score from someplace so how about:
With ActivePresentation.Slides(2).Shapes("TheScoreBox").TextFrame.TextRange
theScore = clng(.Text)
End with

theScore = theScore + 10
ActivePresentation.Slides(2).Shapes("TheScoreBox") _
.TextFrame.TextRange.Text = theScore

' and then update all of the other slides in the presentation that have a
' scorebox

Dim oSld as Slide
Dim oScorebox as Shape

For each oSld in ActivePresentation.Slides
on error resume next
Set oScorebox = oSld.Shapes("TheScoreBox")
if not oScorebox is Nothing Then
oScoreBox.TextFrame.TextRange.Text = cstr(theScore)
End If
Next


End Sub
 
Hi Steve,
Thank you so much for your help. I followed your instructions and it worked.
Can I apply the similar instructions to have a second score box totally
independent from the first score box on the same slides?
Thanks again,
Dori
PS. thanks to David too.
 
Yes, you just need another box with another name (such as
"TheOtherScoreBox"), and another variable with another name (such as
"theOtherScore"), and another procedure with another name (such as
"IncreaseOtherScore").
--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.PowerfulPowerPoint.com/
 
Hi Steve,
Thank you so much for your help. I followed your instructions and it worked.
Cool!

Can I apply the similar instructions to have a second score box totally
independent from the first score box on the same slides?

Sure ... off top of head, you'd use the same macro but change theScoreBox to
e.g. theScoreBox2 and name the shape accordingly on the slides.
 
Back
Top