VBA code for removing all custom animations from a PowerPoint presentation

When I post my PowerPoint slides on my website for my students, I sometimes remove the animations. Animations are nice for controlling when things appear on the screen during the discussion. (Does anyone remember the old technique of covering part of the overhead slide with paper?) However, my purpose in releasing my PowerPoint slides is to give students a record of what we cover in the class discussion, so animations only get in the way for students.

To make it easier for me to create a student version of the slides, I use the following VBA code to delete all the custom PowerPoint animations in a file. It is based on some VBA code written by John Wilson at PPTAlchemy.

Sub remove_all_custom_animations()
   Dim osld As Slide
   Dim i As Integer
   For Each osld In ActivePresentation.Slides
      With osld.TimeLine.MainSequence
         For i = .Count To 1 Step -1
            .Item(i).Delete
         Next i
      End With
   Next osld
End Sub

 
– Eric DeRosia