0
votes

My PowerPoint has a timeline which i created my self with "SmartArt" and Shapes. Now i want that all the shapes in this timeline will fill automatically with dates if i edit the first date.

In the picture you can see my timeline.enter image description here

I am totally new to PowerPoint VBA so i do not even know how to call this macro.

I would write the makro like this:

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

So my two problems are, how can i call the macro if i fill a date to the shape 1 (left from the red arrow) and will my macro even work the way i write it?

1

1 Answers

0
votes

I think you are confusing Shapes with the individual elements (nodes) of SmartArt.

Smart Art is a effectively a single shape with its own inbuilt elements. Therefore, with i being your looper you should be looking at

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

Where 99 is the number of your shape (although you are better to refer to it by name).