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

Slides Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.