Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generating a random number during a slide show

12,731 views
Skip to first unread message

Pamela McDonald

unread,
Mar 27, 2003, 2:41:02 PM3/27/03
to
I'm looking for a way to generate a random number (1-10)
during a PowerPoint slide show. For example during a game
activity supported by a PowerPoint presentation I would
ask the participants to select a number. I would click
(or whatever) to have PowerPoint randomly select a
number. The participants with a number closest to the
randomly selected number would go first.

Does anybody have any suggestions on how to accomplish
this?

B

unread,
Mar 27, 2003, 2:56:50 PM3/27/03
to
Are you familiar with VBA? If you are, it is a simple matter of asking for
a random number (which the computer supplies as a decimal between 0 and 1),
then formatting it into the range you want.

x = INT ( RND * 9 ) + 1
INT tells the computer you want an integer
RND asks for the random decimal
9 is the range the numbers will span
and 1 is the starting point

Then all you need to do is plug this number in where you want it.

B

"Pamela McDonald" <pmcd...@sempra.com> wrote in message
news:052001c2f498$cce0b500$3001...@phx.gbl...

Pamela McDonald

unread,
Mar 27, 2003, 4:42:24 PM3/27/03
to
I very much appreciate the response to my question.
I'm afraid I don't know VBA. Could you elaborate just
a little on how the VBA program is associated with
the PowerPoint.

>.
>

B

unread,
Mar 27, 2003, 6:56:49 PM3/27/03
to
VBA = Visual Basic for Applications

It is a programming language that allows the user to direct what the
application (PowerPoint, in this case) does more directly. It can be
accessed from PowerPoint => Tools => Macros => Visual Basic Editor.

At this point, I should caution you. VBA is very flexible, powerful, and
frustrating. If you want to know this route then I'd recommend a better
tutor then I. But let's give it a go, shall we?

1) Under view => toolbars => controls
(Show the controls in a toolbar)

2) Click on the Command Button
(If you do not know which this is, let the cursor hold over it and the
help label should identify it after a moment)

3) Move the cursor over the slide, click and drag the button to size and
release.
(You now have a button on your slide)

4) Double click on the button
(This opens the Visual Basic Editor)

5) On the next line below "Private Sub CommandButton1_Click()" type these
two lines:
x = Int(Rnd * 9) + 1
CommandButton1.Caption = Str(x)

6) Close the VBA window

7) Run the presentation

When you click on the command button, it should change from words to a
random number from 1 to 10.

Hope this gets you started on your path.

B

"Pamela McDonald" <pmcd...@sempra.com> wrote in message

news:010901c2f4a9$c10202a0$a601...@phx.gbl...

Steve Rindsberg

unread,
Mar 27, 2003, 7:04:13 PM3/27/03
to
How do I USE this VBA stuff in PowerPoint?
http://www.rdpslides.com/pptfaq/FAQ00033.htm

That and the stuff in either direction should give you an idea about
VBA/PPT.

--

Using the Web view of the newsgroup?
Visit http://www.rdpslides.com/pptfaq/FAQ00024.htm to learn a better way!
======================
Steve Rindsberg PPT MVP
PPTools: http://www.pptools.com
PPT FAQ: http://www.pptfaq.com
Featured PPTGeek at PPTLive, http://www.pptlive.com


"Pamela McDonald" <pmcd...@sempra.com> wrote in message

news:010901c2f4a9$c10202a0$a601...@phx.gbl...

Pamc

unread,
Mar 31, 2003, 1:12:07 PM3/31/03
to

Thank you very very much for your help!
I tried this and it works great. It does exactly
what I was trying to acomplish.

>.
>

0 new messages