A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.
Here's an example that will help. You need to specify the Design (ie, the Master), which will be 1 unless there are multiple masters, and you need to specify the INDEX of the custom layout within that design. If you know the index number and are sure it won't change, then the first example below will be simplest.
If you know the custom layout's name, you can call the GetLayoutIndexFromName function, as I've done in the second example.
Sub Test()
With ActivePresentation
' get the layout by index:
.Slides.AddSlide .Slides.Count + 1, .Designs(1).SlideMaster.CustomLayouts(13)
' or get the layout by name:
.Slides.AddSlide .Slides.Count + 1, .Designs(1).SlideMaster.CustomLayouts( _
GetLayoutIndexFromName("MyLayout1", .Designs(1)))
End With
End Sub
Function GetLayoutIndexFromName(sLayoutName As String, oDes As Design) As Long
Dim x As Long
For x = 1 To oDes.SlideMaster.CustomLayouts.Count
If oDes.SlideMaster.CustomLayouts(x).Name = sLayoutName Then
GetLayoutIndexFromName = x
Exit Function
End If
Next
End Function