Share via


Slides.AddSlide Method

PowerPoint Developer Reference

Creates a new slide, adds it to the Slides collection, and returns the slide.

Syntax

expression.AddSlide(Index, pCustomLayout)

expression   An expression that returns a Slides object.

Parameters

Name Required/Optional Data Type Description
Index Required Int The index of the slide to be added.
pCustomLayout Required CustomLayout The layout of the slide.

Return Value
Slide

Example

The following example shows how to use the Add method to add a new slide to the Slides collection. It adds a new slide in index position 2 that has the same layout as the first slide in the active presentation.

Visual Basic for Applications
  Public Sub Add_Example()
Dim pptSlide As Slide
Dim pptLayout As CustomLayout

Set pptLayout = ActivePresentation.Slides(1).CustomLayout
Set pptSlide = ActivePresentation.Slides.AddSlide(2, pptLayout)

End Sub

See Also