troubleshooting Question

Is there a way to delay a VBA Macro without pausing Animations in Power Point?

Avatar of Jorge Coronel
Jorge CoronelFlag for Mexico asked on
Microsoft OfficeVBAMicrosoft PowerPoint
12 Comments1 Solution20 ViewsLast Modified:
Ok, so I'm making a Game in Power Point. The problem is that I made a gameplay loop where as the player makes choices and moves foward via slides, but some of these slides can be re-used to use less of them.

How the game works/Is structured:
The problem is that time/timing is essential to the game's core, and I can't use the Advance Slides Feature because I need the player to go back to a previous Slide after X amount of time. In fact I don't know why Microsoft didn't implemented this feature before themselves....

Photo of the feature that I'm trying to create/implement into my game:

So to send the player to X Slide after Y amount of time I've tried using functions that "Wait" before executing a macro such as:

waitTime = 3  
   Start = Timer    
   While Timer < Start + waitTime        


Function Wait(Seconds As Double) As Boolean   
    Static StartTime As Double    If StartTime = 0 Then StartTime = Timer   
    If Timer - StartTime >= Seconds Then       
        Wait = True        StartTime = 0       
    End If   
End Function
The problem with these functions is that they literally pause the whole Power Point Presentation(I want Animations to keep playing while the macro does it's job.), and since I'm making a Power Point Game, I don't want it to do that because it messes with the experience and the flow of the Game.

So is there a way to make a Macro or a Function that only tracks time without pausing the animations in PPT, and after X amount of time executes code? Or perhaps fusing functions and macros into one so it can ease my work?

Something like this:
Sub GameLoop() 
SlideShowWindows(1).View.GotoSlide (X) Waitfor 3
If SlideShowWindows(1).View.CurrentShowPosition = X Then
SlideShowWindows(1).View.GotoSlide (Y) 
End If
End Sub
By the way I found useful information in the matter, although I'm not sure on how to implement those to my own functions or macros, its complicated. I will leave reference links:

Thanks in advance!

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros