Function Reference

_PPT_Close

Closes all presentations and the instance of the PowerPoint application.

#Include <PowerPoint.au3>
_PPT_Close($oPPT[, $iSaveChanges = True])

 

Parameters

$oPPT PowerPoint application object as returned by _PPT_Open.
$bSaveChanges [optional] Specifies whether changed presentations should be saved before closing (default = True).

 

Return Value

Success: 1.
Failure: 0 and sets @error.
    1 - $oPPT is not an object or not an application object
    2 - Error returned by method Application.Quit. @extended is set to the COM error code
    3 - Error returned by method Application.Save. @extended is set to the COM error code

 

Remarks

_PPT_Close closes all presentations (even those opened manually by the user for this instance after _PPT_Open)
and the specified PowerPoint instance.

 

Related

_PPT_Open

 

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 or connect to an already running PowerPoint instance
; ******************************************************************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_Close", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_Open Example 1", "PowerPoint Application has been opened successfully.")

; *****************************
; Close the PowerPoint instance
; *****************************
_PPT_Close($oPPT)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_Close Example 1", "Error closing the PowerPoint application." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Sleep(2000)
Global $aProcesses = ProcessList("PowerPnt.exe")
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_Close Example 1", "Function ended successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " PowerPoint instance(s) still running.")