Function Reference

_PPT_PresentationPrint

Print one/multiple/all slides of a presentation.

#Include <PowerPoint.au3>
_PPT_PresentationPrint($oPresentation[, $iStartingSlide = 1[, $iEndingSlide = Default[, $iCopies = 1[, $sPrinter = Default]]]])

 

Parameters

$oPresentation Presentation object.
$iStartingSlide [optional] Number of the first slide to be printed (default = 1).
$iEndingSlide [optional] Number of the last slide to be printed (default = keyword Default = last slide of the presentation).
$iCopies [optional] Number of copies to be printer (default = 1).
$sPrinter [optional] Sets the name of the printer (default = keyword Default = Active printer)

 

Return Value

Success: 1.
Failure: 0 and sets @error.
    1 - $oPresentation is not an object or not a presentation object
    2 - $sSlide is an object but not a SlideRange object
    3 - Error occurred when printing the presentation. @extended is set to the COM error code returned by the PrintOut method
    4 - Error occurred when creating the WScript.Network object. @extended is set to the COM error code
    5 - Error occurred when setting the default printer. @extended is set to the COM error code returned by the SetDefaultPrinter method
    6 - Error occurred when re-setting the default printer. @extended is set to the COM error code returned by the SetDefaultPrinter method
    7 - Error occurred when retrieving current default printer. @extended is set to the COM error code returned by the ActivePrinter property
    8 - Error occurred when setting printer connection. @extended is set to the COM error code returned by the AddWindowsPrinterConnection method

 

Remarks

Method PrintOut only supports a single range of consecutive slides.
To print a single slide set parameters $iStartingSlide and $iEndingSlide to the same number.

 

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 an example presentation
; **********************************************************
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationPrint Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
    MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationPrint Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _PPT_Close($oPPT)
    Exit
EndIf

; ****************************************
; Print slides 2 and 3 of the presentation
; ****************************************
_PPT_PresentationPrint($oPresentation, 2, 3)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationPrint Example 1", "Error printing '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationPrint Example 1", "Presentation '" & $sPresentation & "' successfully printed.")