Slides.AddSlide Method (PowerPoint)

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.

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

Remarks

If your Visual Studio solution includes the Microsoft.Office.Interop.PowerPoint reference, this method maps to the following types:

  • Microsoft.Office.Interop.PowerPoint.Slides.Add(int, Microsoft.Office.Interop.PowerPoint.PpSlideLayout)

  • Microsoft.Office.Interop.PowerPoint.Slides.AddSlide(int, Microsoft.Office.Interop.PowerPoint.CustomLayout)

See Also

Concepts

Slides Object Members

Slides Object