Copies or moves the specified slide(s) before or after a specified slide in the same or a different presentation. Duplicates slides in the same presentation.
#Include <PowerPoint.au3>
_PPT_SlideCopyMove($oSourcePresentation, $vSourceSlide[, $oTargetPresentation = $oSourcePresentation[, $vTargetSlide = Default[, $iFunction = 1]]])
Parameters
$oSourcePresentation | Presentation object of the source presentation. |
$vSourceSlide | Slide or Slides to process. Format of this parameter is described in _PPT_SlideRangeSet. |
$oTargetPresentation | [optional] Presentation object of the target presentation where slides should be copied/moved to (default = keyword Default = $oSourcePresentation). |
$vTargetSlide | [optional] Index or name of the slide that the slides on the Clipboard are to be pasted before (default = keyword Default = copy after the last slide in the presentation). |
$iFunction | [optional] Specifies how to process the slides: 1: Copy the specified slide(s) to the target presentation (default) 2: Move the specified slide(s) to the target presentation 3: Duplicate the specified slide(s) in the source presentation 4: Copy the specified slide(s) from the source presentation to the clipboard 5: Cut the specified slide(s) from the source presentation to the clipboard |
Return Value
Success: SlideRange object that represents the pasted objects for $iFunction = 1, 2 to another presentation and 3.
Remarks
None.
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 a presentation
; *************************************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open presentation 1
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPresentation1 = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; **************************************************
; Example 1:
; Copy slides 1 and 2 to the end of the presentation
; **************************************************
_PPT_SlideCopyMove($oPresentation1, "1-2", Default, 4, 1)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example 1", "Error copying slides." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_SlideCopyMove Example 1", "Slides 1 and 2 copied to the end of the presentation.")
; **************************************************
; Example 2:
; Duplicate slides 3 and 4
; **************************************************
_PPT_SlideCopyMove($oPresentation1, "3-4", Default, Default, 3)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example 2", "Error copying slides." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_SlideCopyMove Example 2", "Slides 3 and 4 successfully duplicated.")
; **************************************************
; Example 3:
; Move slide 2 from presentation1 to Presentation 2.
; Insert the moved slide before slide 2
; **************************************************
; Open presentation 2
$sPresentation = @ScriptDir & "\Presentation2.pptx"
Global $oPresentation2 = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; Move slide
_PPT_SlideCopyMove($oPresentation1, 2, $oPresentation2, 2, 2)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_SlideCopyMove Example 3", "Error moving slide." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_SlideCopyMove Example 3", "Slide 2 from Presentation1 moved to Presentation2 before slide 2.")