Function Reference

_PPT_PresentationSaveAs

Saves a presentation with a new filename and/or type.

#Include <PowerPoint.au3>
_PPT_PresentationSaveAs($oPresentation, $sFilePath[, $iFormat = $ppSaveAsDefault[, $bOverWrite = False]])

 

Parameters

$oPresentation Presentation object to be saved.
$sFilePath FilePath of the file to be written to (no extension).
$iFormat [optional] PowerPoint writeable filetype. Can be any value of the PpSaveAsFileType enumeration.
$bOverWrite [optional] True overwrites an already existing file (default = False).

 

Return Value

Success: 1.
Failure: 0 and sets @error.
    1 - $oPresentation is not an object or not a presentation object
    2 - $iFormat is not a number
    3 - File exists, overwrite flag not set
    4 - File exists but could not be deleted
    5 - Error occurred when saving the presentation. @extended is set to the COM error code returned by the SaveAs method

 

Remarks

$sFilename is the filename without extension. "test" is correct, "test.pps" is wrong.

 

Related

_PPT_PresentationSave

 

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>
#include <File.au3>

; *************************
; Create application object
; *************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationSaveAs Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; Open an existing presentation
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationSaveAs Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; ********************************************************************************
; Save the presentation to the tempdir as slideshow and overwirte an existing file
;*********************************************************************************
Global $sDrive = "", $sDir = "", $sFilename = "", $sExtension = ""
Global $aPathSplit = _PathSplit($oPresentation.Name, $sDrive, $sDir, $sFilename, $sExtension)
_PPT_PresentationSaveAs($oPresentation, @TempDir & "\" & $sFilename, $ppSaveAsShow, True)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationSaveAs Example", "Error saving presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationSaveAs Example", "Presentation '" & $sPresentation & "' has been saved as '" & @TempDir & "\" & $oPresentation.Name & "'.")