PDA

View Full Version : [SOLVED:] Not configure animation order in powerpoint using vba



Jhon90
01-31-2023, 10:27 PM
Hi, Sir
Need some help.
I can easily move animation order from animation pane by using up/down. But is it possible through vba code ?
I upload two images(1st one for initial & 2nd one is require result & used afterprevious effect) for better understanding. Any solution will be highly appreciated.

John Wilson
02-01-2023, 12:49 AM
You will need to probably work on this but the basic principle is:


Sub Move_ani()
Dim osld As Slide
Dim oeff As Effect
On Error GoTo err:
Set osld = ActiveWindow.Selection.SlideRange(1)
For Each oeff In osld.TimeLine.MainSequence
If oeff.Shape.Name = "image_logo" Then
'example move up 4
oeff.MoveTo oeff.Index - 4
End If
Next oeff
Exit Sub
err:
MsgBox err.Description
End Sub

Jhon90
02-02-2023, 10:16 AM
Thanks sir. Now working as I wanted. Sir I have one question, if there are three animation for the selected shape then I have to select according to the animation type ie if oeff.EffectType = msoAnimEffectSpin then

John Wilson
02-02-2023, 11:32 AM
Yes, or maybe duration or some other aspect as well.