A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Random number



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2004, 12:51 AM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default Random number

In article , Alec Stonehouse wrote:
HI Group,

I want PPT to generate a random number (between 1 and 20) on a buton click.
I have never tried using VBA and suspect this is the only way to do it.
If a kind person has any ideas and lots of patience, I would love to hear
from you.


Sub MakeARandomNumber()

Dim MaxNumber As Long

' Edit this to be the highest number you're willing to accept
MaxNumber = 42

Randomize ' Initialize random-number generator.
MsgBox (Int(MaxNumber * Rnd) + 1)

End Sub

That's the code. Have a read here to learn ... er ... where to stick it. ;-)

How do I USE this VBA stuff in PowerPoint?
http://www.rdpslides.com/pptfaq/FAQ00033.htm

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com

  #2  
Old May 19th, 2004, 01:26 AM
David M. Marcovitz
external usenet poster
 
Posts: n/a
Default Random number

Check out Examples 8.13 through 8.17 on my web site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on Examples by Chapter and click on Chapter 8 to find the examples. These examples use random numbers in VBA in a variety of ways.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/

  #3  
Old May 19th, 2004, 06:25 PM
Alec Stonehouse
external usenet poster
 
Posts: n/a
Default Random number

Thanking you all. I am on a big journey I think.


"David M. Marcovitz" wrote in message
news
Check out Examples 8.13 through 8.17 on my web site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on Examples by Chapter and click on Chapter 8 to find the examples.
These examples use random numbers in VBA in a variety of ways.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.