OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy

Ascertain if a shape is animated (PowerPoint 2002+)


The custom animations in PowerPoint 2002+ are quite different as compared to earlier version, it introduces 'Timelines' for animations. The recommended way to check for whether a shape is animated or not is as shown below:


Function IsShapeAnimated(oShp As Shape) As Boolean
Dim oEffect As Effect
With oShp.Parent.TimeLine.MainSequence
    Set oEffect = .FindFirstAnimationFor(oShp)
    If oEffect Is Nothing Then
        IsShapeAnimated = False
        IsShapeAnimated = True
    End If
    Set oEffect = Nothing
End With
End Function

Sub Test()
With ActivePresentation.Slides(1)
    If IsShapeAnimated(.Shapes(1)) Then
        MsgBox "Shape is animated", vbInformation, "Shape Animation"
        MsgBox "Shape is not animated", vbInformation, "Shape Animation"
    End If
End With
End Sub

Related:Assign interactive animation

Copyright 1999-2022 (c) Shyam Pillai. All rights reserved.