Add related procedures in class SectionProperties (PowerPoint VBA)

This page presents procedures from class SectionProperties related to the theme Add: AddBeforeSlide and AddSection

AddBeforeSlide

Adds a section immediately before the specified slide index, and returns the index of the new section.

The indices of sections after the newly inserted section are automatically incremented by one. If a section break exists immediately before the specified slide index, the new section is placed after the section break, with the result that the preceding section is now empty, and the specified slide index is now the first slide of the new section. If the presentation does not contain any sections and you call this method, passing a SlideIndex value greater than 1, a new section is created before the first slide and given the default section name.

Syntax : expression.AddBeforeSlide (SlideIndex, sectionName)

Dim lngSlideIndex As Long: lngSlideIndex = 
Dim strsectionName As String: strsectionName = 
Dim lngAddBeforeSlide As Long
lngAddBeforeSlide = ActivePresentation.SectionProperties.AddBeforeSlide(SlideIndex:=lngSlideIndex, sectionName:=strsectionName)

Arguments

The following arguments are required:

SlideIndex (Long) - The index of the slide before which to add the section.

sectionName (String) - The name of the new section.

AddSection

Adds a new section at the specified index position and returns the index of the newly created section.

If a section already exists at the specified index position, calling AddSection is equivalent to adding an empty section immediately before that section. The indices of sections after the newly inserted section are automatically incremented by one. sectionIndex can be one larger than the total number of existing sections, as long as it is less than the maximum number of sections allowed (512); this creates a new, empty section at the end. If no sections exist in the presentation, calling this method and passing a sectionIndex value of 1 creates the first section.

Syntax : expression.AddSection (sectionIndex, sectionName)

Dim lngsectionIndex As Long: lngsectionIndex = 
Dim lngAddSection As Long
lngAddSection = ActivePresentation.SectionProperties.AddSection(sectionIndex:=lngsectionIndex)

Arguments

The following argument is required

sectionIndex (Long) - The index of the section before which to add the section.

The following argument is optional

sectionName (String) - The name of the new section.