Question regarding Variables

  • Thread starter Thread starter Phil K
  • Start date Start date
P

Phil K

Is it possible to create and display a variable on one slide and then go to
another slide and display the same variable? .. I use PPT 2003 with Vista.
If I generate a number say 112 on slide #2, I'd like it to display on
another slide.

Phil
 
Thanks Steve ... I did not make my earlier post clear. The variable number
is a random generated number as part of a math question. The intent is that
if you answer incorrectly that the same question with the variable which I
have assigned to a label is displayed in the same question in another slide.
This way I can explain why the answer was incorrect.
 
So then change "112" to the name of the variable that contains the
randomly-generated number.
--David

Thanks Steve ... I did not make my earlier post clear. The variable number
is a random generated number as part of a math question. The intent is that
if you answer incorrectly that the same question with the variable which I
have assigned to a label is displayed in the same question in another slide.
This way I can explain why the answer was incorrect.

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
Thanks Steve and Dave for taking the time. Could not make it work .. I just
can't figure it out why. Will keeping reading and trying.
 
I'll give it a shot. I'm thinking you want to show the prez and on one
slide you enter an answer in a field and then that value appears in a
field on a later slide?

If ImWrong then
IgnoreThis
Else
HeresTheCode
End if
<g>

I'll say slide 2 asks for the answer and slide 6 shows the answer
again.

On slide 2 and 6, make a TextBox using the Control Toolbox (in
View>Toolbars) and assume their names are "TextBox1" each (you can
change them using the Properties box).

Open the VBA Editor (ALT+F11) and copy this code into the object
"Slide2". (Let us know if can't find the object on the left.)

Option Explicit
Private Sub TextBox1_Change()
Slide6.TextBox1.Value = Slide2.TextBox1.Value
End Sub

(Be sure you have the Microsoft Forms Object Library checked in your
References under the Tools menu.)

Now run the prez, enter an answer on slide 2, and see it will appear
again on slide 6.

Does that work for you?

-Melina
 
Thanks Melina for the response. .. I thought maybe your routine would work
but it did not do what I wanted to do.

On slide 2 I have a word math problem and each value is randomly generated.
Labels display the values .. SO I have Label1, Label2, etc. What I am trying
to do is when one clicks on a command button labeled A one is directed to
another slide to show the solution to the problem.

I know that this could maybe be done better with VB or some other way, but I
have to learn Vb or .net. I thought I could get a response at this forum
since it has been helpful before.

Phil
===========
 
Melina ... with a little perseverance got the routine to work .. but
unfortunately it is not what I want it to do. I'd like to have a randomly
generated value displayed in another slide.

But the routine will be saved for future use.

Again Thanks
Phil
 
I'm taking swings with a blindfold on, ya understand. <g> I don't know
exactly your situation. There's lots of ways to do things,


Here's my assumption and one way I'd do it:
On slide 1, I have a word question that includes a few numerical
variables in the problem. I want to randomly generate those variables
and then make the whole problem appear on slide 2 as it was generated
on slide 1. I'll even throw in an extra label on slide 2 that
calculates the correct answer and shows it.

I'll pretend the word problem is, "Bob cut four 2x4’s for a
rectangular frame that would have an inner dimension of x feet long by
y feet high. He then decided he needed a center piece to run
diagonally from corner to corner inside the frame to strengthen it.
Assuming the frame is assembled with 90 degree angles, what length
does the center piece need to be in order to fit?

The variables are x and y.

So, on slide 1 I'd build the following:

Using the Control Toolbox toolbar, I'd make two labels for the
variables, and I'll assume the label names as being "Lable1" and
"Label2". I'd make a third one for the question, "Label3", and enter
the question into it. I'd format all the labels' fonts to look the
same. Then I'd move Label3 behind 1 and 2 and position 1 over "x" and
2 over "y" and then remove those characters from the question and use
spaces to spread out the other words so that labels 1 and 2 seem to be
"inside" the question.

Now, with all that built, I need to see those objects again on a later
slide, so I'd just copy slide 1 and paste it as a new slide, and I'll
assume it's "Slide2". On slide 2, I'd make one more label, "Label4",
which will house the answer.

In the VBA editor (ALT+F11), and in the object "Slide1", I'd paste the
following code:


Option Explicit

Private Sub Label3_Click()
Randomize
Label1.Caption = Int((9 * Rnd) + 1)
Randomize
Label2.Caption = Int((9 * Rnd) + 1)
Slide2.Label1.Caption = Label1.Caption
Slide2.Label2.Caption = Label2.Caption
Slide2.Label4.Caption = FormatNumber _
(Sqr((CLng(Label1.Caption) ^ 2) + (CLng(Label2.Caption) ^ 2)), 1)
End Sub


That's it. Now I run the presentation, and on slide 1 I can click the
question and the variables x and y randomly generate. When they do,
Slide two updates automatically and shows the correct answer. The
"correct answer" provided my math was right, that is. <g>

If you want a write-in textbox on slide one to enter the given answer,
make one of those too on slide1 and slide2. I think I gave you code of
how to make that appear on slide 2 earlier.

-Melina
 
Back
Top