Microsoft Office Tutorials and References
In Depth Information
Making a Random Jump to Another Slide
Option Explicit¶
' * * * * *¶
Sub RandomJumpAny()¶
SlideShowWindows(1).View.GotoSlide _¶
(Rnd * (ActivePresentation.Slides _¶
.Count - 1)) + 1¶
End Sub¶
' * * * * *¶
Sub RandomJumpList()¶
'Variable declaration¶
Dim intDestinationSlide(4) As Integer¶
'Load the array with the slide numbers of slides to jump¶
'to. These can be changed as required. If more than 5¶
'choices are required, the array needs to be resized.¶
'Dim intDestinationSlide(4) As Integer¶
'Replace the 4 with the desired number of slides (less one)¶
'Assign specific slide numbers to the array.¶
intDestinationSlide(0) = 4¶
intDestinationSlide(1) = 6¶
intDestinationSlide(2) = 7¶
intDestinationSlide(3) = 8¶
intDestinationSlide(4) = 10¶
'Jump to a random slide by picking one of the destinations¶
SlideShowWindows(1).View.GotoSlide _¶
intDestinationSlide(Rnd * (UBound(intDestinationSlide)))¶
End Sub¶
The list of potential slides to jump to in the non-random routine can be changed
as needed. Text in the AutoShape must be changed to reflect this as well.
Assign the shapes the Action Setting of one of the two macros: either
RandomJumpAny or RandomJumpList.
Note: This is a PowerPoint presentation mode macro. Presentation mode macros
operate during slide shows; therefore, viewing the show is necessary to use
this macro.
Search JabSto ::

Custom Search