Home | VBA Section | General Section | Downloads | Licensing | 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:

 
' ---------------------------------------------------------------------
' Copyright ©1999-2007, Shyam Pillai, All Rights Reserved.
' ---------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' You may include acknowledgement to the author and a link to this site.
' ----------------------------------------------------------------------
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
    Else
	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"
    Else
        MsgBox "Shape is not animated", vbInformation, "Shape Animation"
    End If
End With
End Sub

Related:Assign interactive animation


Copyright © 1999-2008 Shyam Pillai. All rights reserved.