【问题标题】:PowerPoint: Add Date of Yesterday and Tomorrow to a SlidePowerPoint:将昨天和明天的日期添加到幻灯片
【发布时间】:2021-09-03 07:27:48
【问题描述】:

我想在我的 PowerPoint (2016) 幻灯片上有一个表格,应该如下所示:

sysdate - 1 sysdate sysdate + 1
02.09.2021 03.09.2021 04.09.2021

为保持幻灯片直观,日期应自动更新。

通过使用Insert -> Text -> Date & Time,我可以为中心列添加一个包含当前日期的字段。

如何为昨天和明天添加动态字段?

【问题讨论】:

    标签: date powerpoint powerpoint-2016


    【解决方案1】:

    首先,关注the steps here 为您的表命名。之后,插入一个模块(Alt+F11,Insert - Module)并添加这段代码:

    Sub SetTableHeaders()
        
        Const SlideNo = 1
        Const TableName = "TableName Here"
        
        Dim MyTable As Table
        Set MyTable = ActivePresentation.Slides(SlideNo).Shapes(TableName).Table
        
        MyTable.Rows(1).Cells(1).Shape.TextFrame.TextRange.Text = Format(Now - 1, "yyyy-mm-dd")
        MyTable.Rows(1).Cells(2).Shape.TextFrame.TextRange.Text = Format(Now, "yyyy-mm-dd")
        MyTable.Rows(1).Cells(3).Shape.TextFrame.TextRange.Text = Format(Now + 1, "yyyy-mm-dd")
        
    End Sub
    

    SlideNoTableName 值替换为正确的值。运行 (F5) 设置标题。

    【讨论】:

    • 代码似乎有效。但它不会自动执行。如果显示“SlideNo”,我可以让它自动运行吗?
    • Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow) If SSW.View.CurrentShowPosition = SlideNo Then SetTableHeaders End If End Sub 成功了
    猜你喜欢
    • 2019-10-30
    • 2020-01-09
    • 1970-01-01
    • 2017-08-11
    • 2022-09-26
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    • 1970-01-01
    相关资源
    最近更新 更多