TPE

http://bayanbox.ir/view/263405954590585756/2mobile.png

Tavvafi@gmail.com


≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

خود پاورپوینت اجازه انتخاب ترانزیشن های تصادفی را برای شما فراهم آورده است، اما شما نمی توانید تشخیص دهید که کدام ترنزیشن هماکنون در پرزنتیشن تان در حال اجرا خواهد بود. پاورپوینت به شما اجازه نمی دهد که شما لیستی از ترنزیشن ها داشته باشید تا آنها را آگاهانه برای استفاده تصادفی مدیریت کنید.

کد زیر این مفهوم را به عنوان مسئله مورد توجه قرار داده و به نحوی عمل می کند که مدیریت آکاهانه ای برای استفاده از ترنزیشن های تصادفی را برای برنامه نویس فراهم آورد.

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