Function Reference

_PPT_PresentationNew

Creates a new presentation.

#Include <PowerPoint.au3>
_PPT_PresentationNew($oPPT[, $sTemplate = "", [, $bVisible = True]])

 

Parameters

$oPPT PowerPoint application object where you want to create the new presentation.
$sTemplate [optional] path to a template file (extension: pot, potx) or an existing presentation to be applied to the presentation (default = "" = no template).
$bVisible [optional] True specifies that the presentation window will be visible (default = True).

 

Return Value

Success: the presentation object.
Failure: 0 and sets @error.
    1 - $oPPT is not an object or not an application object
    2 - Error returned by method Presentations.Add. @extended is set to the COM error code
    3 - Specified template file does not exist
    4 - Error returned by method ApplyTemplate. @extended is set to the COM error code

 

Remarks

None.

 

Related

_PPT_PresentationAttach, _PPT_PresentationClose, _PPT_PresentationOpen

 

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
; *************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Create a new presentation and add 3 slides (including title slide)
; *****************************************************************************
Global $oPresentation = _PPT_PresentationNew($oPPT)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationNew Example 1", "Error creating new presentation." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

_PPT_SlideAdd($oPresentation, 1, 3)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationNew Example 1", "Error adding slides to the presentation." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationNew Example 1", "Presentation has been created successfully.")