0
votes

I am making a powerpoint presentation where I need to time how long each slide is displayed for to 2 decimal places e.g. 1.45 seconds, and be able to retrieve each time after the presentation. I'm guessing the easiest way would be to somehow use a VB timer and store each as a public variable, but have no real idea how to start. I have limited experience using Visual Basic.

Any help is greatly appreciated.

1

1 Answers

1
votes

This feature exists in powerpoint.

http://www.howtogeek.com/howto/34395/how-to-time-your-powerpoint-slides-for-more-effective-presentations/

Edit. For more accurate timing: this example will display timing in a messagebox, everytime you change slide..

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long
Public startTime As Long

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    If SSW.View.CurrentShowPosition = 1 Then
        startTime = GetTickCount()
    Else
        MsgBox GetTickCount() - startTime
    End If
End Sub

instead of a messagebox, put this in a file, or something.

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Public startTime As Long
Public strPath As String

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    strPath = "timing.txt"
    Dim fs, f

    If SSW.View.CurrentShowPosition = 1 Then
        startTime = GetTickCount()

        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.CreateTextFile("d:\testfile.txt", True)
        f.WriteLine "Started new presentation"
        f.Close
    Else
        Dim DeltaTime As Long
        DeltaTime = GetTickCount() - startTime

        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.OpenTextFile("d:\testfile.txt", ForAppending, TristateFalse)

        f.Write "time in milliseconds since start: "
        f.WriteLine Str(DeltaTime)
        f.Close
    End If
End Sub