Add one or multiple slides to a presentation.
#Include <PowerPoint.au3>
_PPT_SlideAdd($oPresentation[, $vIndex = Default[, $iSlides = 1[, $sLayout = Default]]])
Parameters
$oPresentation | Presentation object. |
$vIndex | [optional] The name or index where the slide is to be added (default = keyword Default = add the slide at the end of the presentation). |
$iSlides | [optional] Number of slides to be added (default = 1). |
$vLayout | [optional] The layout of the slide (default = keyword Default = Layout of the preceding/next slide). |
Return Value
Success: the slide object of the first slide added.
Remarks
If $vLayout ist set to Default then the layout of the slide with index $vIndex is used.
Related
Example
#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=N
#include <PowerPoint.au3>
#include <MsgBoxConstants.au3>
; **********************************************************
; Create application object and open an example presentation
; **********************************************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideAdd Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideAdd Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; *****************************************************************************
; Insert three slides before slide 2, use a different layout
; *****************************************************************************
_PPT_SlideAdd($oPresentation, 2, 3, $ppLayoutTextAndChart)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideAdd Example 1", "Error adding slides." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_SlideAdd Example 1", "Three slides added before slide 2.")