请问如何在PPT中用vba实现一个定时器?
前提如下:
1.在PPT中有一个excel中的柱状图链接.
2.修改excel的时候实现PPT的实时更新(不用右键点击更新链接来实现).
[解决办法]
参考
- VB code
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)Private State As BooleanPrivate Sub Label1_Click() Dim preT As Date, curT As Long If State Then State = False Exit Sub End If State = True preT = DateAdd("h", 1, Time) Do curT = DateDiff("s", Time, preT) Label1.Caption = Format((curT \ 3600 & ":" & (curT Mod 3600) \ 60 & ":" & (curT Mod 3600) Mod 60), "HH:MM:SS") DoEvents Sleep (500) DoEvents If Val(curT) < 0 Or Not State Then Label1.Caption = "stop" '开始考试 Exit Sub End If LoopEnd Sub