Function Reference

_PPT_PresentationOpen

Opens an existing presentation.

#Include <PowerPoint.au3>
_PPT_PresentationOpen($oPPT, $sFilePath[, $bReadOnly = False[, $bVisible = True]])

 

Parameters

$oPPT PowerPoint application object where you want to open the presentation
$sFilePath Path and filename of the file to be opened.
$bReadOnly [optional] True opens the presentation as read-only (default = False).
$bVisible [optional] True specifies that the presentation window will be visible (default = True).

 

Return Value

Success: a presentation object. @extended is set to 1 if $bReadOnly = False but read-write access could not be granted. Please see the Remarks section for details.
Failure: 0 and sets @error.
    1 - $oPPT is not an object or not an application object
    2 - Specified $sFilePath does not exist
    3 - Unable to open $sFilePath. @extended is set to the COM error code returned by the Open method

 

Remarks

When you set $bReadOnly = False but the presentation can't be opened read-write @extended is set to 1.
The presentation was opened read-only because it has already been opened by another user/task or the file is set to read-only by the filesystem.
If you modify the presentation you need to use _PPT_PresentationSaveAs() to save it to another location or with another name.
+
The PowerPoint object model does not allow to pass read/write passwords to open a protected presentation.

 

Related

_PPT_PresentationAttach, _PPT_PresentationClose, _PPT_PresentationNew

 

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 PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

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