PresentationNewSlide Event

Microsoft PowerPoint Visual Basic

Occurs when a new slide is created in any open presentation, as the slide is added to the Slides collection.

Private Sub application_PresentationNewSlide(ByVal Sld As Slide)

application     An object of type Application declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Sld     The new slide.

Example

This example modifies the background color for color scheme three and then applies the modified color scheme to the new slide. Next, it adds default text to shape one if it has a text frame.

Private Sub App_PresentationNewSlide(ByVal Sld As Slide)
    With ActivePresentation
        Set CS3 = .ColorSchemes(3)
        CS3.Colors(ppBackground).RGB = RGB(240, 115, 100)
        Windows(1).Selection.SlideRange.ColorScheme = CS3
    End With

    If Sld.Layout <> ppLayoutBlank Then
        With Sld.Shapes(1)
            If .HasTextFrame = msoTrue Then
               .TextFrame.TextRange.Text = "King Salmon"
            End If
        End With
    End If
End Sub