Reset Power Point Animations Macro

Hello, I'm an Indie Game Developer. And I'm mostly here to ask about VBA focused to MS Office, Power Point.
Published:
Edited by: Andrew Leniart
Everyone wants to have the option to Reset Animations without exiting the Slide Show.
All of the code and files are going to be shown in the Article.
Please take a look at my functions and I will explain along the way.

Functions:

Public Function actual() As Integer
actual = SlideShowWindows(1).View.CurrentShowPosition
End Function


Public Function rangeSlides(indice As Integer) As Boolean


    ' Counts how many Slides the Presentation currently has.
   
If indice <= 0 Or indice > ActivePresentation.Slides.Count Then rangeSlides = False Else rangeSlides = True
End Function


Public Function scene(Optional ByVal numSlide As Integer = 0) As Slide
If Not rangeSlides(numSlide) Then numSlide = actual


    ' Checks on which Slide the player currently is.
   
Set scene = ActivePresentation.Slides(numSlide)
End Function

Actual is just a Shortcut, not much to explain there. For rangeSlides I used a simple count method; note that it counts ALL of the Slides and the order it's the same as shown in PowerPoint, it's not like in VBA, where if you have 20 Slides and erase 1, Slide 19 is still considered 20. Last but not least, Scene is a combination of two shortcuts, with an If statement that dictates that if a Slide number is not specified then the number is the currently active Slide.

As for the Macro itself:

Public Sub ResetAnimations()


' Resets all of the animations of all of the Slides in the Presentation.


For i = 1 To ActivePresentation.Slides.Count
With scene(i).SlideShowTransition
.Hidden = msoTrue
.Hidden = msoFalse
End With
Next
End Sub

The Macro is pretty self-explanatory for the most part. It counts the slides in the presentation and hides/shows all of them, causing them to restart the objects animations in them.

If You want to quickly test the functions/macro. Here's a sample file I made.
Reset Macro.pptm

Please feel free to modify the functions, or the macro itself to your liking, and thanks for reading the article.
1
40 Views
Hello, I'm an Indie Game Developer. And I'm mostly here to ask about VBA focused to MS Office, Power Point.

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.

Get access with a 7-day free trial.
You Belong in the World's Smartest IT Community