Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Apply a random transition to every slide in a presentation

PowerPoint allows you to choose the Random transition to apply a random transition to a slide or to all slides in a presentation, but you may not like certain of its transitions.

PowerPoint doesn't let you create a list of the transitions that you want to use and then apply them randomly.

The VBA code below does just that. The subroutine FillTransitionArray fills an array (a list for all practical purposes) with all of the PowerPoint 2000 transitions. By commenting out some of the code, you can eliminate the transitions you don't want to use from the list (see example of commented out transition in the code).

Then when you run ApplyRandomSlideTransitions on your presentation, it applies transitions chosen randomly from the list to each slide. Some transitions are applicable to shapes only and cause errors if applied to slides; the subroutine traps those errors and tries another transition until it finds one that works.

Sub ApplyRandomSlideTransitions()
' Applies a random transition to every slide in the active presentation
' Allows you to specify the list of acceptable transitions (ie, exclude those you don't want)
    On Error Resume Next

    Dim oSld As Slide
    Dim bTransitionApplied As Boolean
    Dim lEffect As Long
    ' Create an array to hold the transitions you want to use
    Dim rayTransitions() As Long
    ' Fill the array with transitions
    Call FillTransitionArray(rayTransitions)
    Debug.Print UBound(rayTransitions)
    Randomize ' Initialize random-number generator.
    For Each oSld In ActivePresentation.Slides
        bTransitionApplied = False
        While Not bTransitionApplied
            ' pick a random effect from the array of effects
            lEffect = rayTransitions(Int((UBound(rayTransitions) * Rnd) + 1))
            ' try to apply the effect
            oSld.SlideShowTransition.EntryEffect = lEffect
            If Err.Number = 0 Then
                bTransitionApplied = True
            Else
                Err.Clear
            End If
        Wend
    Next oSld

End Sub

Sub FillTransitionArray(rayTransitions As Variant)

    ReDim rayTransitions(1 To 1) As Long
    rayTransitions(1) = ppEffectNone    ' 0

    ' Add the transitions you want to the array - comment out the ones you don't want to use
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCut '257

    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCutThroughBlack '258

    ' For example, this is commented out and won't be used
    ' We don't want PPT assigning random effects that we don't want it to use!
    'ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    'rayTransitions(UBound(rayTransitions)) = ppEffectRandom '513

    ' Note: some of these transitions are applicable to shapes only, not slides
    ' The errorhandling in the main routine copes with that; no worries

    ' Note: these are the transitions from PowerPoint 2000

    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectBlindsHorizontal '769
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectBlindsVertical '770
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCheckerboardAcross '1025
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCheckerboardDown '1026
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverLeft '1281
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverUp '1282
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverRight '1283
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverDown '1284
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverLeftUp '1285
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverRightUp '1286
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverLeftDown '1287
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCoverRightDown '1288
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectDissolve '1537
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFade '1793
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverLeft '2049
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverUp '2050
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverRight '2051
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverDown '2052
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverLeftUp '2053
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverRightUp '2054
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverLeftDown '2055
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectUncoverRightDown '2056
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectRandomBarsHorizontal '2305
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectRandomBarsVertical '2306
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsUpLeft '2561
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsUpRight '2562
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsDownLeft '2563
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsDownRight '2564
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsLeftUp '2565
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsRightUp '2566
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsLeftDown '2567
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStripsRightDown '2568
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectWipeLeft '2817
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectWipeUp '2818
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectWipeRight '2819
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectWipeDown '2820
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectBoxOut '3073
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectBoxIn '3074
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromLeft '3329
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromTop '3330
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromRight '3331
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromBottom '3332
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromTopLeft '3333
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromTopRight '3334
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromBottomLeft '3335
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlyFromBottomRight '3336
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectPeekFromLeft '3337
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectPeekFromDown '3338
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectPeekFromRight '3339
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectPeekFromUp '3340
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCrawlFromLeft '3341
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCrawlFromUp '3342
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCrawlFromRight '3343
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectCrawlFromDown '3344
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomIn '3345
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomInSlightly '3346
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomOut '3347
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomOutSlightly '3348
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomCenter '3349
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectZoomBottom '3350
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStretchAcross '3351
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStretchLeft '3352
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStretchUp '3353
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStretchRight '3354
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectStretchDown '3355
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSwivel '3356
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSpiral '3357
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSplitHorizontalOut '3585
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSplitHorizontalIn '3586
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSplitVerticalOut '3587
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectSplitVerticalIn '3588
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlashOnceFast '3841
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlashOnceMedium '3842
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectFlashOnceSlow '3843
    ReDim Preserve rayTransitions(1 To UBound(rayTransitions) + 1) As Long
    rayTransitions(UBound(rayTransitions)) = ppEffectAppear '3844

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Search terms:random,transition,list,specific


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Apply a random transition to every slide in a presentation
http://www.pptfaq.com/FAQ00595_Apply_a_random_transition_to_every_slide_in_a_presentation.htm
Last update 07 June, 2011
Created: