title: Making a fake screensaver in PPT using VBA
body: <p>I'm trying to mimic a screensaver on PowerPoint that will return to my first slide after X amount of seconds of inactivity.</p>
  
  <p>The PowerPoint presentation is all just completely image based and every click will transition through the slides, so it doesn't have to be sophisticated at all, just that at the start of each slide it counts down 5 seconds, then returns to slide 1 (which is my fake screensaver page).</p>
  
  <p>I've already got something working in a basic format, it takes you to the first page after 5 seconds, but the timer doesn't restart once you go to a new slide, once it starts counting down, regardless of if you move to the next slide after 3 seconds, you don't get another 5 second countdown, it just finishes the remaining 2 seconds and redirects you.</p>
  
  <p>VBA is definitely not my primary language, I'm just piecing this together with what I can find, but my current code is below</p>
  
  <pre><code>Sub Auto_NextSlide(Index As Long)
  
  Dim Delay, Start
  
  If Index &gt; 1 Then
      Delay = 5
      Start = Timer
      Do While Timer &lt; Start + Delay
          DoEvents
      Loop
  
      SlideShowWindows(1).View.GotoSlide (SlideShowWindows(1).Presentation.Slides(1).SlideIndex)
  End If
  
  End Sub
  </code></pre>