|
Declare PtrSafe Function SetTimer Lib "user32" (ByVal hWnd As Long, _
ByVal nIDEvent As Long, ByVal uElaspe As Long, ByVal lpTimerFunc As Long) As Long
Declare PtrSafe Function KillTimer Lib "user32" _
(ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Dim MyTimer As Long, ds() As Object, m, n
Sub sTimer() '显示时间
m = ActivePresentation.Slides.Count
l = ActivePresentation.Slides.Application.Width
ReDim ds(1 To m)
For i = 1 To m
x = 0
For Each da In ActivePresentation.Slides(i).Shapes
If da.Name = "TextBox 1" Or da.Name = "文本框 1" Then
Set ds(i) = da: ds(i).TextFrame.TextRange.Text = "": x = 1
End If
Next
If x = 0 Then
Set ds(i) = ActivePresentation.Slides(i).Shapes.AddTextbox(1, l / 2 - 125, 0, 250, 50)
ds(i).TextFrame.TextRange.Font.Color = RGB(0, 0, 255)
End If
Next
MyTimer = SetTimer(0, 0, 1000, AddressOf sNow): n = 1
End Sub
Sub sNow(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idevent As Long, ByVal Systime As Long)
If n = 1 Then
For i = 1 To m
sj = Format(Now, "yyyy/mm/dd hh:mm:ss")
ds(i).TextFrame.TextRange.Text = sj
Next
Else: KillTimer 0, MyTimer
End If
DoEvents
End Sub
Sub nStop() '停止显示
n = 0
End Sub |
|