Share via

Select multiple Animation using VBA

Anonymous
2013-04-12T08:37:53+00:00

Hi

I have a slide with lots of animations.

I am looking for a way to easily change all "ZOOM" animations to have timing 5 sec

The easiest I could find is to "select" the animations (using the CTRL key) and change the timing to 5 sec at once.

but If I would like later to change the timing to 4 sec, I will have to re-select the animations manually again...

So

I am looking for piece of code that will scan the animations on the current slide, and select all ZOOM animations for me....

===============================================================================

this is my starting point:

Dim Cursld As Slide

Dim i As Integer

Cur_Slide_No = ActiveWindow.View.Slide.SlideIndex

Set Cursld = ActivePresentation.Slides(Cur_Slide_No)

deselect all animations

For i = Cursld.TimeLine.MainSequence.Count To 1 Step -1

AnnType = Cursld.TimeLine.MainSequence(i).EffectType

====================================

if AnnType = "ZOOM" then select it  (in addition to the currently selected animations...)

====================================

Next i

so after this code will run, I will have the "ZOOM" animations selected.

Thanks for your help !!!!!

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2013-04-12T13:27:30+00:00

    I don't think you can select animations in code like that.

    You can easily change the duration of Zooms though.

    Sub zoomit()

    Dim osld As Slide

    Dim oeff As Effect

    Dim sngDur As Single

    Set osld = ActiveWindow.View.Slide

    sngDur = InputBox("Zoom duration?")

    For Each oeff In osld.TimeLine.MainSequence

    If oeff.EffectType = msoAnimEffectFadedZoom Then

    oeff.Timing.Duration = sngDur

    End If

    Next

    End Sub

    Note that msoAnimEffectZoom is NOT Zoom, it's basic zoom. (Only a genius could have thought of that!!!)

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-04-12T14:24:50+00:00

    ooooooooooh

    Who am I to fight againts lions.....

    too small

    I take your advices and will code it as SR suggested

    Many thanks !!!!

    I could have waste many hours.....

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-04-12T14:20:30+00:00

    Selecting items is in the animation taskpane is not supported programatically, so you will be hard pressed to find a straight forward solution to this. It will be possible to get make the selection work by sending the appropriate windows messages to the control but will involve far more work that you may be interested in putting in.

    A coded solution which does not involve the PowerPoint UI as John illustrated in his example is more straighforward. Perhaps less generic, but you can create your own UI to accept input parameters.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-04-12T14:10:39+00:00

    I understood - I just don't know a way to do that!

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2013-04-12T13:44:14+00:00

    Thanks SR 

    My intention is to make it as generic so that :

    I will select single animation

    then run a code that will select all animations of same type as the one I selected.

    then - I will be able to apply the real change as I wish all all the "selected" animations manually using right click etc...

    that way - I will code only once, and will be able to "select" all animations - based on my single initial select.

    I hope I am more clear now

    thanks for your help !!!!!

    Was this answer helpful?

    0 comments No comments