Home > Blockchain >  VBA PowerPoint: Insert custom slide layout into current position not the end of the slide pack
VBA PowerPoint: Insert custom slide layout into current position not the end of the slide pack

Time:12-16

ISSUE I know one can insert a PPT layout with one of the standard PpSlideLayout constants (ie: ppLayoutBlank) into current position however I cannot figure out to do the same with custom slide layout. (ie as below with 01 Divider slide numbered)



HELP

CODE BELOW Inserts the custom slide layout named 01 Divider slide numbered to the end of the powerpoint presenatation.

'Insert Divider page layout
Sub Add01DividerSlideNumbered()
    Dim oSlides As Slides, oSlide As Slide
    Set oSlides = ActivePresentation.Slides
    Set oSlide = oSlides.AddSlide(oSlides.Count   1, GetLayout("01 Divider slide numbered"))
End Sub

'Callback for customButton onAction
Sub Adds01DividerSlideNumbered(control As IRibbonControl)
    Call Module1.Add01DividerSlideNumbered
End Sub

CodePudding user response:

You can get the current slide index as follows...

ActivePresentation.Windows(1).View.Slide.SlideIndex
  • Related