添加空白幻灯片

时间:2013-01-24 16:17:46

标签: powerpoint powerpoint-vba

如何在某个特定位置添加空白幻灯片?例如第二个位置。

1 个答案:

答案 0 :(得分:5)

Sub InsertSlide()
    Dim oLayout As CustomLayout
    Dim lPosition As Long
    Dim oSl As Slide

    ' What layout/master should the new slide use?
    ' Designs(1) = the first SlideMaster in the presentation
    ' CustomLayouts(1) = a Title layout
    ' To get other layout index numbers, look at the layout gallery
    ' in PPT, count left to right, top to bottom
    Set oLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(1)
    lPosition = 3

    Set oSl = ActivePresentation.Slides.AddSlide(lPosition, oLayout)
    With oSl
        ' do whatever you need to with the slide
    End With
End Sub