Microsoft Office Tutorials and References
In Depth Information
Random Madness
Random Madness
This macro changes the color, shape, size, and rotation of objects at random
during an active PowerPoint presentation.
Example file:
P006.ppt
Scenario: Create a visually active filler slide to use between
slides in presentations.
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Sub RandomMadness()¶
'Variable declaration¶
Dim intSld As Integer¶
Dim RandomShape As Integer¶
'Determine current slide¶
'Store the result in the variable IntSld¶
intSld = ActivePresentation.SlideShowWindow.View.CurrentShowPosition¶
Do While SlideShowWindows.Count > 0 And _¶
ActivePresentation.SlideShowWindow.View.CurrentShowPosition = intSld¶
'Pick the shape number of a random shape on this slide¶
RandomShape = Int((Rnd *
(ActivePresentation.Slides(intSld).Shapes.Count)) + 1)¶
'Reseed the random number generator¶
Randomize¶
With ActivePresentation.Slides(intSld).Shapes(RandomShape)¶
'Change the horizontal position of the shape¶
'to fall in the range between -6 and +6¶
.Left = .Left + Int(Rnd * 7) - 4¶
'Change the vertical position in a similar fashion¶
.Top = .Top + Int(Rnd * 7) - 4¶
'Change the rotation by -3 to + 3¶
.Rotation = .Rotation + Int(Rnd * 7) - 3¶
'Reseed the random numer generator¶
Randomize¶
'Change the width¶
.Width = .Width + ((Rnd * 5) - 2)¶
'Change the Height¶
.Height = .Height + ((Rnd * 5) - 2)¶
'Change the color¶
.Fill.ForeColor.RGB = RGB(Rnd * 256, Rnd * 256, Rnd * 256)¶
End With¶
'Catch up on events¶
DoEvents¶
Pwr
 
Search JabSto ::




Custom Search