---
title: "VBA 实现 POWERPOINT 的TIMER 事件"
author: "cjc"
date: "2005-10-09T22:02:00Z"
tags: []
slug: "vba-powerpoint-timer"
draft: false
lastmod: "2005-10-09T22:02:00Z"
id: 299155
url: "https://cjc.iteye.com/blog/299155"
---

POWERPOINT 无TIMER 控件，也不支持 TIMER 事件。但如果想在播放POWERPOINT 时显示一个动态的时间,有没有可行的办法?笔者曾为此十分苦恼,四处求救，始终没有满意的答复（多数建议添加FLASH 格式的CLOCK），近日想起了延时函数SLEEP，一试竟然成功，问题终于得以解决，特此与广大CSDN朋友共享。代码如下

Option Explicit  
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)  
Sub main()  
ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = Format(Time, "hh:nn:ss")  
Do While Time &lt; #11:59:00 PM#  
Sleep 1000  
ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = Format(Time, "hh:nn:ss")  
DoEvents  
Loop  
End Sub