View Full Version : Random Slide Jump with limit- Help
speechpath
02-28-2008, 12:12 PM
I'm very much a newbie with VBA. I'm a teacher and I'm using a VBA code in a PPT program I've written for a special needs student. I learned how to use this code to jump to a random slide. How can I specify the number of times the random jump happens before the slide show moves to a specific (non randomized) slide?
Here's the code:
Sub randjump()
randomize
Dim Inum As Integer
Inum=Int(highest # in range-(lowest # in range -1)*rnd+lowest # in range)
ActivePresentation.SlideShowWindow.View.GotoSlide(Inum)
End Sub
Thanks for the help!
Rob
John Wilson
02-28-2008, 12:29 PM
Recognise the code!
You could use a static variable to count the clicks and then an If ...Else
Sub randjump()
Randomize
Static Iclix As Integer
Dim Inum As Integer
Iclix = Iclix + 1
If Iclix < 5 Then
Inum = Int((3 * Rnd) + 3)
ActivePresentation.SlideShowWindow.View.GotoSlide (Inum)'random
Else: ActivePresentation.SlideShowWindow.View.GotoSlide (6)'slide 6 eg
Iclix = 0
End If
End Sub
speechpath
02-28-2008, 12:33 PM
Thank you John. I'll give it a try.
John Wilson
02-28-2008, 12:54 PM
I should probably have said "insert your own numbers into the Inum line!"
speechpath
02-28-2008, 04:31 PM
John, I tried it and it worked well.
Do you know of any way to automatically advance to a specific slide? I'm using PPT '04 on a Mac, and I don't see an option to do this. Maybe there is a code VBA code that will do it?
John Wilson
02-29-2008, 12:43 AM
I don't use a mac but on a PC (and I guess a mac) there's a mouseover hyperlink option?
You can have a shape appear as part of the animation sequence and trigger the hyperlink.
Problems
- the arrow has to be showing
- sometimes you find the need to wiggle the mouse (which is no use)
I usually make a slide transition to a new slide with the trigger shape (full slide size) appearing with previous in an animation that moves eg "fly in from bottom". This seems to simulate the mouse moving if you see what I mean
If the shape has a mouseover hyperlink to the chosen slide it should automatically go there.
-
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.