PDA

View Full Version : Automatic Slide Transition



jj79miro
04-01-2008, 06:34 AM
I did a macro for a counter pointing to 1 slide om my presentation. Since the macro starts the slideshow and runs contisnously the Automatic Slide Trasition (set to 5 seconds on all slides) does not works.

Any solution to this?:dunno

John Wilson
04-01-2008, 12:09 PM
Maybe if you post some code and explain a little more clearly what you need to achieve?

jj79miro
04-01-2008, 05:14 PM
Here is the code



Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Tmr()
'Just in the eventuality that you click the start button twice
'isRunning stores the current state of the macro
'TRUE = Running; FALSE = Idle
Static isRunning As Boolean
If isRunning = True Then
End
Else
isRunning = True
Dim datEnd As Date
Dim datNow As Date
Dim sngDiff As Single
Dim lngDays As Long
Dim lngHours As Long
Dim lngMinutes As Long
Dim lngSeconds As Long



datEnd = #4/15/2008 11:59:59 PM#
datNow = Now

'On Slide 1, Shape 1 is the textbox
With ActivePresentation.Slides(1)
With .Shapes(1)
'Countdown in seconds
Do While datNow < datEnd
' Suspend program execution for 1 second (1000 milliseconds)
Sleep 1000
sngDiff = datEnd - datNow
lngDays = CLng(sngDiff)
lngHours = Hour(sngDiff)
lngMinutes = Minute(sngDiff)
lngSeconds = Second(sngDiff)

.TextFrame.TextRange.Text = lngDays & " Days " & lngHours & " hours " & lngMinutes & " minutes " & lngSeconds & " Seconds"
datNow = Now
' Very crucial else the display won't refresh itself
DoEvents
Loop
End With

isRunning = False
End

End With
End If
End Sub


What I want is slide 1 to transition automatically to slide 2 while the macro is still running. The the presentation will go back to slide 1 and slide 2 so on. Apparently the Automatic Transition of slide 1 after 5 seconds will not run until the macro is finish..

jj79miro
04-01-2008, 05:15 PM
here is the presentation

jj79miro
04-01-2008, 05:17 PM
HEre is the file

John Wilson
04-01-2008, 11:52 PM
I'm guessing that you adapted the code from Shyam Pillai? You would do better to use SetTimer and KillTimer calls. Shyam explains how to use these here http://skp.mvps.org/ppt00021.htm (scroll down)

SetTimer will call your procedure at set intervals leaving PowerPoint free to do other things in between.