Access/VBA Library

PopulateTextShape_Example

Example function for PopulateTextShape : This example creates a new presentation containing three slide. The first slide contains a an automatic countdown from 5 to 1, the second slide an automatic countdown from "00:05" till "00:01" and the final slide contains five paragraphs of text. To view the next paragraph a mouse-click is needed.

Syntax

PopulateTextShape_Example()
Code
Sub PopulateTextShape_Example()
    Set Application_ = New PowerPoint.Application
    
    Dim Content
    Dim NewPPT As Presentation
    
    Set NewPPT = Application_.Presentations.Add
    
    With NewPPT
        ' Add a new slide for a countdown counter
        Content = Array(5, 4, 3, 2, 1, 0)
        With .Slides.AddSlide(1, .SlideMaster.CustomLayouts(1))
            .Select
            SlideTitle = "Countdown (seconds)"
            .Shapes(2).Select
            Call PopulateTextShape(Content, True, 1)
            '
            ' Jump to the next slide after 5 seconds
            '
            .SlideShowTransition.AdvanceOnTime = msoTrue
            .SlideShowTransition.AdvanceTime = 5
        End With
        
        ' Add a new slide for a countdown timer
        Content = Array("00:05", "00:04", "00:03", "00:02", "00:01", "Let's start!")
        With .Slides.AddSlide(2, .SlideMaster.CustomLayouts(1))
            .Select
            SlideTitle = "Countdown (timer)"
            .Shapes(2).Select
            Call PopulateTextShape(Content, True, 1)
            
            '
            ' Jump to the next slide after 8 seconds
            '
            .SlideShowTransition.AdvanceOnTime = msoTrue
            .SlideShowTransition.AdvanceTime = 8
        End With
        
        ' Add a new slide for a some text splitting
        Content = Array("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ", _
                        "Aenean commodo ligula eget dolor.", _
                        "Aenean massa. ", _
                        "Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. ", _
                        "Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.")
                        
        With .Slides.AddSlide(3, .SlideMaster.CustomLayouts(1))
            .Select
            SlideTitle = "Lorum ipsum (click)"
            .Shapes(2).Select
            Call PopulateTextShape(Content, False)
        End With
        '
        ' Start the slide show
        '
        .SlideShowSettings.Run
    End With
End Sub

PowerPointtag:PowerPoint

See also

  • PopulateTextShape
  • SlideTitle