Powerpoint时间显示每张幻灯片的时长

时间:2015-08-04 08:08:24

标签: vb.net vba powerpoint

我正在制作一个powerpoint演示文稿,我需要将每张幻灯片的显示时间设置为2位小数,例如1.45秒,并且能够在演示后每次检索。我猜最简单的方法是以某种方式使用VB计时器并将每个存储为公共变量,但不知道如何开始。我使用Visual Basic的经验有限。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

此功能存在于powerpoint中。

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

编辑。 要获得更准确的计时:此示例将在每次更改幻灯片时在消息框中显示计时..

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

而不是消息框,将其放在文件或其他内容中。

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