前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PowerPoint中如何设置现在时间并实时更新

PowerPoint中如何设置现在时间并实时更新

作者头像
繁华是客
发布2023-03-03 20:12:11
1.7K0
发布2023-03-03 20:12:11
举报

在工作中,PowerPoint做实时时间可以通过Add-in也可以通过VB来做,下面我用VB来做,本文最后还有做好的模板文件。

PowerPoint 设置

Step 1: 新建文本框并在文本框输入”–:–:–”

Step 2: 在Home里面找到Find下面的Select并选择Selection Pane

Step2
Step2

Step 3: 在右方Selection选择双击Textbox的名字并更名为ShpClock

Step3
Step3

Step 4: 去Options添加Developer Tab。

Step4
Step4

Visual Basic设置

Step 5: 点击developer Tab然后点击Visual Basic设置

Step5
Step5

Step 6: 在Microsoft Visual Basic for Applcations打开后点击Insert–>Module

Step 7: 在输入代码页面输入如下代码

代码语言:javascript
复制
Public clock As Boolean
Public currenttime, currentday As String


Sub Pause()
Dim PauseTime, start
PauseTime = 1
start = Timer
Do While Timer < start + PauseTime
DoEvents
Loop
End Sub

Sub StartClock()
clock = True
Do Until clock = False
On Error Resume Next
currenttime = Format((Now()), "hh:mm:ss")
currenttime = Mid(currenttime, 1, Len(currenttime) - 0)
ActivePresentation.Slides(SlideShowWindows(1).View.CurrentShowPosition).Shapes("shpClock").TextFrame.TextRange.Text = currenttime
Pause
Loop
End Sub

Sub OnSlideShowPageChange(ByVal objWindow As SlideShowWindow)
clock = False
ActivePresentation.Slides(SlideShowWindows(1).View.CurrentShowPosition).Shapes("shpClock").TextFrame.TextRange.Text = "--:--:--"
End Sub

Sub OnSlideShowTerminate()
clock = False
End Sub

Step 8: 关闭VBA窗口,点击文本框,然后找到Insert–>Action并将Action Setting内的Mouse Click Tab选择Run macro并选择为StartClock

Step8
Step8

Step 9: 记得另存为启用宏的PowerPoint PPTM格式

Step9
Step9

Step 10: 点击时间即可激活实时时间

其他资料

1. Microsoft时间代码参考 2. 文件样本下载

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-10-12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • PowerPoint 设置
  • Visual Basic设置
  • 其他资料
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档