【问题标题】:PowerPoint automatically fill shapesPowerPoint 自动填充形状
【发布时间】:2019-10-13 14:56:34
【问题描述】:

我的 PowerPoint 有一个时间线,我用“SmartArt”和 Shapes 创建了我自己。现在,如果我编辑第一个日期,我希望此时间轴中的所有形状都会自动填充日期。

在图片中你可以看到我的时间线。

我对 PowerPoint VBA 完全陌生,所以我什至不知道如何调用这个宏。

我会这样写makro:

Sub Fill_Shapes()
    Dim StartDate As Date
    Dim myShape As Object

    Set myShape = ActiveSlide.Shapes(1)
    StartDate = myShape.Text

    For i = 2 To 14
        Set myShape = ActiveSlide.Shapes(i)
        With Application.Presentations(1).Slides(3).Shapes(i).TextFrame.TextRange
            .Text = StartDate  + 15
        End With
        StartDate = myShape.Text
    Next
End If

所以我的两个问题是,如果我将日期填充到形状 1(红色箭头左侧),我该如何调用宏,我的宏甚至可以按照我编写的方式工作吗?

【问题讨论】:

    标签: vba powerpoint shapes


    【解决方案1】:

    我认为您将 Shapes 与 SmartArt 的单个元素(节点)混淆了。

    Smart Art 实际上是一个具有自己内置元素的单一形状。因此,i 是你的循环器,你应该看看

    With Application.Presentations(1).Slides(3).Shapes(99).SmartArt.AllNodes.Item(i).TextFrame2.TextRange
    

    99 是你的形状的编号(尽管你最好用名字来引用它)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多