Created with HTMHelp © Sebastian Walter
Function List
_PPT_Open
Connects to an existing PowerPoint instance or creates a new one.
Parameters:
$bVisible (Optional) - True specifies that the application will be visible (default = True).
Return Value:
Success - the PowerPoint application object.
Failure - 0 and sets @error.
1 - Unable to create PowerPoint object. @extended is set to the COM error code
Author: water
Related: _PPT_Close
_PPT_Close
Closes all presentations and the instance of the PowerPoint application.
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.
Author: water
Related: _PPT_Open
_PPT_ErrorNotify
Sets or queries the debug level.
Parameters:
$iDebug - Debug level. Possible values are:
-1 - Return the current settings
0 - Disable debugging
1 - Enable debugging. Output the debug info to the console
2 - Enable Debugging. Output the debug info to a MsgBox
3 - Enable Debugging. Output the debug info to a file defined by $sDebugFile
4 - Enable Debugging. The COM errors will be handled (the script no longer crashes) without any output
$sDebugFile (Optional) - File to write the debugging info to if $iDebug = 3 (default = @ScriptDir & "\PowerPoint_Debug.txt")
Return Value:
Success (for $iDebug => 0) - 1, sets @extended to:
0 - The COM error handler for this UDF was already active
1 - A COM error handler has been initialized for this UDF
Success (for $iDebug = -1) - one based one-dimensional array with the following elements:
1 - Debug level. Value from 0 to 3. Check parameter $iDebug for details
2 - Debug file. File to write the debugging info to as defined by parameter $sDebugFile
3 - True if the COM error handler has been defined for this UDF. False if debugging is set off or a COM error handler was already defined
Failure - 0, sets @error to:
1 - $iDebug is not an integer or < -1 or > 4
2 - Installation of the custom error handler failed. @extended is set to the error code returned by ObjEvent
3 - COM error handler already set to another function
Author: water
_PPT_CommentAdd
Add a comment anywhere on a Slide or connected to a Shape.
Parameters:
$oPresentation - Presentation object.
$vSlide - A SlideRange object as returned by _PPT_SlideRangeSet for a single Slide. See _PPT_SlideRangeSet for details.
$vShape - A ShapeRange object as returned by _PPT_ShapeRangeSet for a single Shape. See _PPT_ShapeRangeSet for details.
If you set this parameter to Default $iLeft/$iTop will be used to place the comment anywhere on the Slide.
If you provide a Shape the comment will be placed near the Shape. For details please see the $iLeft and $iTop parameter.
$iLeft - The position, measured in points, of the left edge of the comment, relative to the left edge of the presentation.
When $vShape is set the following values will be accepted to place the comment:
1 - The comment will be placed at the left edge of the Shape
2 - The comment will be placed at the right edge of the Shape
3 - The comment will be placed at the top edge of the Shape
4 - The comment will be placed at the bottom edge of the Shape
$iTop - The position, measured in points, of the top edge of the comment, relative to the top edge of the presentation.
When $vShape is set the following values will be accepted to place the comment:
1 - The comment will be placed at the top (for $iLeft = 1 or 2) or left (for $iLeft = 3 or 4) side of the Shape
2 - The comment will be placed at the middle of the specified edge of the Shape
3 - The comment will be placed at the bottom (for $iLeft = 1 or 2) or right (for $iLeft = 3 or 4) side of the Shape
$sComment - The comment's text.
$sAuthor (Optional) - The author of the comment (default = @UserName). Please see Remarks
$sAuthorInitials (Optional) - The author's initials (default = @UserName)
$sProviderID (Optional) - The service that provides contact information (default = "AD"). Please see Remarks
$sUserID (Optional) - The ID of the user providing the comment (default = @UserName)
Return Value:
Success - the Comment object.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a Presentation object
2 - Error occurred creating the SlideRange from $vSlide. @extended is set to the error code returned by _PPT_SlideRangeSet
3 - Error occurred creating the ShapeRange from $vShape. @extended is set to the error code returned by _PPT_ShapeRangeSet
4 - Error setting the Comment. @extended is set to the COM error code
5 - $iTop is invalid. Has to be a value between 1 and 3
6 - $iLeft is invalid. Has to be a value between 1 and 4
Remarks: $sProviderID isn't well documented by MS. But "AD" (Active Directory) and "Windows Live" seem to be valid ProviderIDs.
For $sAuthor I couldn't find a quick and easy way to get the full name of the logged on user. So the initials will be used here as well.
Author: water
_PPT_CommentDelete
Delete a single Comment from a Slide or all Comments from a SlideRange.
Parameters:
$oObject - Presentation object (if you want to delete > 1 Comment) or Comment object (if you want to delete a single Comment)
$vSlides (Optional) - SlideRange object as returned by _PPT_SlideRangeSet for the Slide(s) to process. See _PPT_SlideRangeSet for details (default = 0 = all Slides)
Return Value:
Success - 1, @extended is set to the number of Comments deleted.
Failure - 0 and sets @error.
1 - $oObject is not an object or not a Presentation object
2 - Error occurred creating the SlideRange from $vSlide. @extended is set to the error code returned by _PPT_SlideRangeSet
3 - Error deleting a specified single Comment. @extended is set to the COM error code
4 - Error deleting all Comments from a Slide. @extended is set to the COM error code
Remarks: If $vSlides defines a SlideRange all Comments from this SlideRange will be deleted.
Author: water
_PPT_CommentList
Get a list of all Comments in a presentation.
Parameters:
$oPresentation - Presentation object.
Return Value:
Success - two-dimensional zero based array holding the following information:
0 - Object of the Comment
1 - SlideIndex of the Slide where the Comment is located
2 - Comment Text
3 - Comment Author
4 - Comment AuthorInitials
5 - DateTime the Comment has been created
6 - The position, measured in points, of the left edge of the comment, relative to the left edge of the presentation.
7 - The position, measured in points, of the top edge of the comment, relative to the top edge of the presentation.
8 - Number of Replies to this Comment.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a Presentation object
Author: water
_PPT_ConvertUnits
Convert units (like centimeters) to other units (like points).
Parameters:
$iValue - Int or Float to convert
$iConversion - Conversion to execute. Can be one of the following:
1 - CentimetersToPoints
2 - InchesToPoints
3 - PicasToPoints
4 - PointsToCentimeters
5 - PointsToInches
6 - PointsToLines
7 - PointsToPicas
Return Value:
Success - Converted value.
Failure - 0 and sets @error.
1 - $iConversion is invalid
Author: water
_PPT_ExcelImport
Import a Range of cells or a Chart from Excel and insert as Table or Picture into a Slide.
Parameters:
$oPresentation - Object of the presentation to process.
$vSlide - Single Slide to process. Please see _PPT_SlideRangeSet for possible values.
$vShape - Table shape to copy the Excel cells to. If needed the table will be expanded to fit the Excel Cell Range.
If set to Default a new Table Shape will be created. This parameter is ignored for $iFlag = 2.
$oObject - Range object of the Excel cells to process or Excel Chart object.
$iFlag - Processing options. Can be a combination of the following values:
1 - Insert the Range as a new Picture Shape
2 - Insert the Range as a new Table Shape (editable)
3 - Insert a Chart as a new Picture Shape
Return Value:
Success - the Shape object that has been created to hold the imported Excel Range.
Failure - 0 and sets @error.
1 - $vSlides is invalid. @extended is set to the error code returned by _PPT_SlideRangeSet
2 - Error when copying the Excel Range as picture to the clipboard. @extended is set to the COM error code
3 - Error when pasting the Excel from the clipboard. @extended is set to the COM error code
4 - Error reading the Excel Range. @extended is set to the COM error code
5 - Error creating the Table Shape. @extended is set to the COM error code
6 - Error writing Excel data to the Table Shape. @extended is set to the COM error code
7 - $vShape is not a Table Shape
8 - $vShape is not a Shape
9 - $iFlag is invalid
10 - Error when copying the Excel Chart object. @extended is set to the COM error code
11 - Error when pasting the Excel Chart object. @extended is set to the COM error code
Remarks: https://img.chandoo.org/vba/Automatically_Create_PowerPoint_From_Excel_VBA_Code.txt
https://analystcave.com/vba-paste-from-excel-to-powerpoint/
Author: water
_PPT_HeaderFooterGet
Sets the Header/Footer for a Slide/Slides or the SlideMaster/NotesMaster/HandoutMaster/TitleMaster of a Presentation.
Parameters:
$oPresentation - Presentation object.
$iFlag - Processing options. Can be a combination of the following values:
1 - Set the SlideMaster Footer
2 - Set the NotesMaster Footer and/or Header
4 - Set the HandoutMaster Footer and/or Header
8 - Set the TitleMaster Footer
16 - Set the Footer for the specified Slide(s)
32 - Clear Header/Footer information that has been set for individual Slides to make sure all Slides display the Header and information you define for the SlideMaster
64 - Specifies if the Footer/Header for the Slide(s)/SlideMaster/NotesMaster/HandoutMaster/TitleMaster will be visible
128 - Determines whether the footer, date and time, and slide number appear on the title slide. Applies to slide masters
256 - Updates all existing Slides with the specified Header/Footer settings
$sFooter (Optional) - Text to use for the Footer. "" will reset the Footer text (default = keyword Default = do not set the Footer).
$sHeader (Optional) - Text to use for the Header. "" will reset the Header text (default = keyword Default = do not set the Header).
$sDateAndTime (Optional) - Format for the automatically updated date and time. Use the PpDateTimeFormat enumeration (default = keyword Default = do not set the DateAndTime).
$bSlideNumber (Optional) - Displays the SlideNumber if set to True (default = keyword Default = do not set the SlideNumber).
$vSlides (Optional) - Slide(s) to process. Please see _PPT_SlideRangeSet for possible values (default = 0 = all Slides).
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation has to be a presentation
2 - Error occurred when setting the Footer for the SlideMaster. @extended is set to the COM error code
3 - Error occurred when setting the Footer/Header for the NotesMaster. @extended is set to the COM error code
4 - Error occurred when setting the Footer/Header for the HandoutMaster. @extended is set to the COM error code
5 - Error occurred when setting the Footer for the TitleMaster. @extended is set to the COM error code
6 - Error occurred when setting the Footer for a SlideRange. @extended is set to the COM error code
7 - Error returned from _PPT_SetSlideRange. @extended is set to the error code returned by this function
8 - Error clearing individual Header/Footer information
Remarks: CustomLayout and NotesPage can not be processed using this function.
HeaderFooter objects aren't available for Slide objects that represent Notes pages.
The HeaderFooter object that represents a header is available only for a NotesMaster or HandoutMaster.
;+
Parameter $sDateAndTime: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppdatetimeformat
;+
See: https://stackoverflow.com/questions/35739457/vba-powerpoint-2010-replacing-text-in-headers-and-footers
Author: water
Related: _PPT_HeaderFooterList
_PPT_HeaderFooterSet
Sets the Header/Footer for a Slide/Slides or the SlideMaster/NotesMaster/HandoutMaster/TitleMaster of a Presentation.
Parameters:
$oPresentation - Presentation object.
$iFlag - Processing options. Can be a combination of the following values:
1 - Set the SlideMaster Footer
2 - Set the NotesMaster Footer and/or Header
4 - Set the HandoutMaster Footer and/or Header
8 - Set the TitleMaster Footer
16 - Set the Footer for the specified Slide(s)
32 - Clear Header/Footer information that has been set for individual Slides to make sure all Slides display the Header and information you define for the SlideMaster
64 - Specifies if the Footer/Header for the Slide(s)/SlideMaster/NotesMaster/HandoutMaster/TitleMaster will be visible
128 - Determines whether the footer, date and time, and slide number appear on the title slide. Applies to slide masters
256 - Updates all existing Slides with the specified Header/Footer settings
$sFooter (Optional) - Text to use for the Footer. "" will reset the Footer text (default = keyword Default = do not set the Footer).
$sHeader (Optional) - Text to use for the Header. "" will reset the Header text (default = keyword Default = do not set the Header).
$sDateAndTime (Optional) - Format for the automatically updated date and time. Use the PpDateTimeFormat enumeration (default = keyword Default = do not set the DateAndTime).
$bSlideNumber (Optional) - Displays the SlideNumber if set to True (default = keyword Default = do not set the SlideNumber).
$vSlides (Optional) - Slide(s) to process. Please see _PPT_SlideRangeSet for possible values (default = 0 = all Slides).
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation has to be a presentation
2 - Error occurred when setting the Footer for the SlideMaster. @extended is set to the COM error code
3 - Error occurred when setting the Footer/Header for the NotesMaster. @extended is set to the COM error code
4 - Error occurred when setting the Footer/Header for the HandoutMaster. @extended is set to the COM error code
5 - Error occurred when setting the Footer for the TitleMaster. @extended is set to the COM error code
6 - Error occurred when setting the Footer for a SlideRange. @extended is set to the COM error code
7 - Error returned from _PPT_SetSlideRange. @extended is set to the error code returned by this function
8 - Error clearing individual Header/Footer information
Remarks: CustomLayout and NotesPage can not be processed using this function.
HeaderFooter objects aren't available for Slide objects that represent Notes pages.
The HeaderFooter object that represents a header is available only for a NotesMaster or HandoutMaster.
;+
Parameter $sDateAndTime: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppdatetimeformat
;+
See: https://stackoverflow.com/questions/35739457/vba-powerpoint-2010-replacing-text-in-headers-and-footers
Author: water
Related: _PPT_HeaderFooterList
_PPT_PresentationAttach
Attaches to the frist presentation where the search string matches based on the selected mode.
Parameters:
$sString - String to search for.
$sMode (Optional) - specifies search mode:
FileName - Name of the open presentation (e.g. "Presentation1.pptx")
FilePath - Full path to the open presentation (default) (e.g. "C:\Temp\Presentation1.pptx")
Title - Caption of the first window of the presentation (e.g. "Presentation1.pptx [Write protected]")
$bPartialMatch (Optional) - When $sMode = Title then $sString must fully match when False (default) or partial if True
Return Value:
Success - the PowerPoint presentation object.
Failure - 0 and sets @error.
1 - An error occurred. @extended is set to the COM error code
2 - $sMode is invalid
3 - $sString can't be found in any of the open presentations
Author: water
Related: _PPT_PresentationClose, _PPT_PresentationNew, _PPT_PresentationOpen
_PPT_PresentationClose
Closes the specified presentation.
Parameters:
$oPresentation - Presentation object.
$bSave (Optional) - If True the presentation will be saved before closing (default = True).
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Error occurred when saving the presentation. @extended is set to the COM error code returned by the Save method
3 - Error occurred when closing the presentation. @extended is set to the COM error code returned by the Close method
Remarks: None
Author: water
Related: _PPT_PresentationAttach, _PPT_PresentationNew, _PPT_PresentationOpen
_PPT_PresentationExport
Export one/multiple/all slides of a presentation as PDF or XPS.
Parameters:
$oPresentation - Presentation object.
$sPath - Path/name of the exported file.
$sSlide (Optional) - A string with the index number of the starting (and ending) slide to be exported (separated by a hyphen) (default = Keyword Default = export all slides in the presentation).
$iFixedFormatType (Optional) - The format to which the slides should be exported. Can be any value of the PpFixedFormatType enumeration (default = $ppFixedFormatTypePDF).
$iOutputType (Optional) - The type of output. Can be any value of the PpPrintOutputType enumeration (default = $ppPrintOutputSlides).
$bUseISO19005 (Optional) - Whether the resulting document is compliant with ISO 19005-1 (PDF/A) (default = True).
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 - $sPath is empty
4 - Error occurred when exporting the presentation. @extended is set to the COM error code returned by the ExportAsFixedFormat method
5 - $sSlide is invalid. Has to be "StartingSlide-EndingSlide"
Remarks: Method ExportAsFixedFormat only supports a single range of consecutive slides.
To export a single slide simply pass the slide number as $sSlide.
Author: water
_PPT_PresentationExportGraphic
Export one/multiple/all slides of a presentation in a graphic format.
Parameters:
$oPresentation - Presentation object.
$sPath (Optional) - Directory where the graphics should be stored. The graphics are named Slide<n>. n is the slide number (default = keyword Default = @ScriptDir).
Specify the path without trailing backslash. If the directory does not exist, it will be created.
Existing files with the same name will be overwritten.
$vSlides (Optional) - Slide(s) to process. Please see _PPT_SlideRangeSet for possible values (default = 0 = all Slides).
$sFilter (Optional) - The graphics format in which you want to export slides (default = JPG). See Remarks.
$iScaleWidth (Optional) - The width in pixels of an exported slide (default = keyword Default = do not change the width).
$iScaleHeight (Optional) - The height in pixels of an exported slide (default = keyword Default = do not change the heigth).
$bKeepRatio (Optional) - If set To True the width:height ratio is preserved if width or height is set (default = True)
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $vSlides is invalid. @extended is set to the error code returned by _PPT_SlideRangeSet
3 - $sPath didn't exist and returned an error when the function tried to create it.
4 - Error occurred when exporting the presentation. @extended is set to the COM error code returned by the ExportAsFixedFormat method
Remarks: The specified graphics format must have an export filter registered in the Windows registry.
You need to specify the registered extension (JPG, GIF etc.).
Author: water
_PPT_PresentationList
Returns a list of currently open presentations.
Parameters:
$oPPT - PowerPoint application object to retrieve the list of presentations from
Return Value:
Success - a two-dimensional zero based array with the following information:
0 - Object of the presentation
1 - Name of the presentation/file
2 - Complete path to the presentation/file
3 - Title of the presentation derived from the first window.caption of the presentation
Failure - 0 and sets @error.
1 - $oPPT is not an object or not an application object
Author: water
Related: _PPT_SlideList, _PPT_ShapeList
_PPT_PresentationNew
Creates a new presentation.
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
Author: water
Related: _PPT_PresentationAttach, _PPT_PresentationClose, _PPT_PresentationOpen
_PPT_PresentationOpen
Opens an existing presentation.
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.
Author: water
Related: _PPT_PresentationAttach, _PPT_PresentationClose, _PPT_PresentationNew
_PPT_PresentationPrint
Print one/multiple/all slides of a presentation.
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.
Author: water
_PPT_PresentationSave
Saves a presentation.
Parameters:
$oPresentation - Object of the presentation to save.
Return Value:
Success - 1 and sets @extended.
0 - File has not been saved because it has not been changed since the last save or file open
1 - File has been saved because it has been changed since the last save or file open
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Error occurred when saving the presentation. @extended is set to the COM error code
Remarks: A newly created presentation has to be saved using _PPT_PresentationSaveAs before
Author: water
Related: _PPT_PresentationSaveAs
_PPT_PresentationSaveAs
Saves a presentation with a new filename and/or type.
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.
(default = keyword Default = $ppSaveAsDefault (means: .ppt for PowerPoint < 2007, .pptx for PowerPoint 2007 and later).
$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.
Author: water
Related: _PPT_PresentationSave
_PPT_ShapeAdd
Add a Shape to a single or multiple Slides.
Parameters:
$oPresentation - Object of the presentation to process.
$vSlides - Slides to process. See Remarks.
$iShapeType - Constant from the MsoShapeType enumeration representing the type of Shape to add.
Currently the function supports the following ShapeTypes: MsoChart, MsoLine, MsoPicture, MsoTable, $MsoTextBox.
$iX1 - The position (in Points) of the left edge of the Shape relative to the left edge of the Slide. See Remarks.
$iY1 - The position (in Points) of the top edge of the Shape relative to the left edge of the Slide. See Remarks.
$iX2 - The Width (in Points) of the Shape. See Remarks.
$iY2 - The Height (in Points) of the Shape. See Remarks.
$vP1 (Optional) - Additional parameter for the Addxxxx method of the Shapes collection. See Remarks.
$vP2 (Optional) - Additional parameter for the Addxxxx method of the Shapes collection. See Remarks.
$vP3 (Optional) - Additional parameter for the Addxxxx method of the Shapes collection. See Remarks.
$vP4 (Optional) - Additional parameter for the Addxxxx method of the Shapes collection. See Remarks.
$vP5 (Optional) - Additional parameter for the Addxxxx method of the Shapes collection. See Remarks.
Return Value:
Success - zero-based one dimensional array with a Shape object for each Slide in the SlideRange
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Error occurred creating the SlideRange from $vSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
3 - Error creating the Shape. @extended is set to the COM error code
4 - $iShapeType is invalid
Remarks: In the following table you find the parameters to use based on the ShapeType you want to create:
SHAPETYPE $iX1 $iY1 $iX2 $iY2 $vP1 $vP2 $vP3 $vP4
$MsoChart Left Top Width Height Style Type NewLayout
$MsoLine BeginX BeginY EndX EndY
$MsoPicture Left Top Width Height FileName LinkToFile SaveWithDocument Compress
$MsoTable Left Top Width Height NumRows NumColumns
$MsoTextBox Left Top Width Height Orientation
;+
When you pass Default for $iX1, $iY2, $iX2 or $iY2 then PowerPoint decides where to place the Shape.
;+
For details please check the MS documentation:
$MsoChart https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addchart2
$MsoLine https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addline
$MsoPicture https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addpicture2
$MsoTable https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addtable
$MsoTextBox https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shapes.addtextbox
Author: water
Related: _PPT_ShapeDelete
_PPT_ShapeCopyMove
Copies or moves the specified Shape(s) of a single Slide to the specified Slide(s) in the same or a different Presentation.
Parameters:
$oSourcePresentation - Presentation object of the source presentation.
$vSourceSlide - A SlideRange object as returned by _PPT_SlideRangeSet for a single source Slide. See _PPT_SlideRangeSet and Remarks for details.
$vSourceShapes - A ShapeRange object as returned by _PPT_ShapeRangeSet of the Shapes to process. See _PPT_ShapeRangeSet and Remarks for details.
$oTargetPresentation (Optional) - Presentation object of the target Presentation where Shapes should be copied/moved to (default = keyword Default = $oSourcePresentation).
$vTargetSlides (Optional) - A SlideRange object as returned by _PPT_SlideRangeSet for the target Slide(s) (default = Slide 1).
$iFunction (Optional) - Specifies how to process the Shape(s):
1: Copy the specified Shape(s) to the target Presentation (default)
2: Move the specified Shape(s) to the target Presentation
3: Duplicate the specified Shape(s) on the source Slide. $oTargetPresentation and $vTargetSlides are ignored
4: Copy the specified Shape(s) to the clipboard. $oTargetPresentation and $vTargetSlides are ignored
5: Cut the specified Shape(s) from the source Presentation to the clipboard. $oTargetPresentation and $vTargetSlides are ignored
Return Value:
Success - 1
Failure - 0 and sets @error.
1 - $oSourcePresentation is not an object or not a presentation object
2 - $oTargetPresentation is not an object or not a presentation object
3 - Error occurred creating the SlideRange from $vSourceSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
4 - Error occurred creating the ShapeRange from $vSourceShapes. @extended is set to the error code returned by _PPT_ShapeRangeSet
5 - Error occurred creating the SlideRange from $vTargetSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
6 - $iFunction < 1 or $iFunction > 5
7 - Error occurred when copying the Shape(s). @extended is set to the COM error code returned by the Copy method
8 - Error occurred when cutting the Shape(s). @extended is set to the COM error code returned by the Cut method
9 - Error occurred when inserting Shape(s). @extended is set to the COM error code returned by the Paste method
10 - Error occurred when duplicating Shape(s). @extended is set to the COM error code returned by the Duplicate method
Author: water
_PPT_ShapeDelete
Delete a Shape or Shapes from a single or multiple Slides.
Parameters:
$oPresentation - Object of the presentation to process.
$vSlides (Optional) - Slides to process. See Remarks (default = 0 = all Slides).
$vShapes (Optional) - Shapes to process on each selected Slide. See Remarks (default = 0 = all Shapes).
Return Value:
Success - 1, @extended holds the number of deleted Shapes.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Number of Slides is > 1 but $vShapes is not one of the allowed values: 0, >0 or a string
3 - Error occurred creating the SlideRange from $vSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
4 - Error occurred creating the ShapeRange from $vShapes. @extended is set to the error code returned by _PPT_ShapeRangeSet
Remarks: With this function you can delete a single Shape from multiple Slides or multiple Shapes from a single Slide.
;+
Parameter $vSlides: See _PPT_SlideRangeSet for the format of this parameter
Parameter $vShapes:
If Number of Slides is = 1: All values for _PPT_ShapeRangeSet are valid. See _PPT_ShapeRangeSet for the format of this parameter
If Number of Slides is > 1: only 0 (all Shapes), integer (ID of the Shape) or a string (Name of the Shape) are valid
;+
While looping through the specified Slides all specified Shapes are deleted with a single command.
Errors are ignored and processing continues with the next Slide.
Author: water
Related: _PPT_ShapeAdd
_PPT_ShapeList
Returns a list of shapes in a slide.
Parameters:
$oPresentation - Presentation object to be saved.
$vSlide - Slide for which to list the shapes. The SlideRange object will be created from this Slide.
Please see Remarks in function _PPT_SlideRangeSet.
Return Value:
Success - a two-dimensional zero based array with the following information:
0 - Object of the Shape
1 - Property ID: Number that identifies the shape
2 - Property Name: Name created by PowerPoint or the user
3 - Property Type: Type of the Shape
4 - Property Visible: visibility of the Shape
5 - Property ZOrderPosition: position of the shape in the z-order
6 - Property HasTextFrame: Returns whether the shape has a text frame and can therefore contain text
7 - Property HasTable: Returns whether the shape is a table
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Error occurred creating the SlideRange from $vSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
Remarks: The function only processes the first Slide if parameter $vSlide returns more than one Slide
Author: water
Related: _PPT_PresentationList, _PPT_SlideList
_PPT_SlideAdd
Add one or multiple slides to a presentation.
Parameters:
$oPresentation - Presentation object.
$vIndex (Optional) - The name or index where the slide is to be added (default = keyword Default = add the slide at the end of the presentation).
$iSlides (Optional) - Number of slides to be added (default = 1).
$vLayout (Optional) - The layout of the slide (default = keyword Default = Layout of the preceding/next slide).
Can be any of the PpSlideLayout enumeration or a layout object.
Return Value:
Success - the slide object of the first slide added.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $vIndex is a number and < 1 or > current number of slides + 1
3 - Error occurred when retrieving layout of a slide. @extended is set to the COM error code
4 - Error occurred when adding a slide. @extended is set to the COM error code returned by the Add/AddSlide method
5 - $iSlides is not a number or < 1
Remarks: If $vLayout ist set to Default then the layout of the slide with index $vIndex is used.
If there is no such slide then the layout of the preceding slide is being used.
If there is no such slide then layout $ppLayoutBlank is being used.
Author: water
_PPT_SlideCopyMove
Copies or moves the specified slide(s) before or after a specified slide in the same or a different presentation. Duplicates slides in the same presentation.
Parameters:
$oSourcePresentation - Presentation object of the source presentation.
$vSourceSlide - Slide or Slides to process. Format of this parameter is described in _PPT_SlideRangeSet.
$oTargetPresentation (Optional) - Presentation object of the target presentation where slides should be copied/moved to (default = keyword Default = $oSourcePresentation).
$vTargetSlide (Optional) - Index or name of the slide that the slides on the Clipboard are to be pasted before (default = keyword Default = copy after the last slide in the presentation).
$iFunction (Optional) - Specifies how to process the slides:
1: Copy the specified slide(s) to the target presentation (default)
2: Move the specified slide(s) to the target presentation
3: Duplicate the specified slide(s) in the source presentation
4: Copy the specified slide(s) from the source presentation to the clipboard
5: Cut the specified slide(s) from the source presentation to the clipboard
Return Value:
Success - SlideRange object that represents the pasted objects for $iFunction = 1, 2 to another presentation and 3.
1 for $iFunction = 2 when moving within the same presentation, $iFunction = 4 and 5.
Failure - 0 and sets @error.
1 - $oSourcePresentation is not an object or not a presentation object
2 - $oTargetPresentation is not an object or not a presentation object
3 - Error occurred when copying the slide(s). @extended is set to the COM error code returned by the Copy method
4 - Error occurred when cutting the slide(s). @extended is set to the COM error code returned by the Cut method
5 - Error occurred when moving the slide(s). @extended is set to the COM error code returned by the MoveTo method
6 - Error occurred when inserting slide(s). @extended is set to the COM error code returned by the Paste method
7 - Error occurred when duplicating slide(s). @extended is set to the COM error code returned by the Duplicate method
8 - $iFunction < 1 or $iFunction > 5
9 - You can't duplicate slides to another presentation. $oTargetPresentation = $oSourcePresentation is needed
10 - $vTargetSlide is a number and < 1 or > current number of slides + 1
11 - $vSourceSlide is an object but not a SlideRange object
12 - Error occurred creating the SlideRange for the source presentation. @extended is set to the COM error code returned by the Duplicate method
Author: water
_PPT_SlideDelete
Delete one or multiple slides from a presentation.
Parameters:
$oPresentation - Presentation object.
$vSlide - Slide or Slides to delete. Format of this parameter is described in _PPT_SlideRangeSet.
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Error deleting slides. @extended is set to the COM error code returned by the Delete method
3 - Error occurred creating the SlideRange from $vSlide. @extended is set to the error code returned by _PPT_SlideRangeSet
Author: water
_PPT_SlideList
Returns a list of Slides in a Presentation.
Parameters:
$oPresentation - Presentation object.
Return Value:
Success - a two-dimensional zero based array with the following information:
0 - Object of the Slide
1 - Property SlideID: a unique ID number
2 - Property SlideIndex: index number of the slide within the Slides collection
3 - Property SlideNumber: slide number
4 - Property Name: name of the slide (format: Slide n when created by PowerPoint or user
5 - Property HasNotePages: Indicates whether the Slide has media that resides on a notes page
6 - Property Hidden: Determines whether the specified slide is hidden during a slide show
Failure - 0 and sets @error.
1 - $oPPT is not an object or not an application object
Remarks: For SlideID, SlideIndex and SlideNumber values please see:
https://docs.microsoft.com/en-us/office/vba/api/powerpoint.slide.slideid
https://docs.microsoft.com/en-us/office/vba/api/powerpoint.slide.slideindex
https://docs.microsoft.com/en-us/office/vba/api/powerpoint.slide.slidenumber
Author: water
Related: _PPT_PresentationList, _PPT_ShapeList
_PPT_SlideRangeSet
Creates a SlideRange object with one or multiple slides.
Parameters:
$oPresentation - Presentation object.
$vSlides (Optional) - Slide or Slides to create the SlideRange object from (default = 0 = all Slides). Please see Remarks.
Return Value:
Success - SlideRange object.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $vSlides is an object but not a Slide or SlideRange object
3 - Error occurred creating the SlideRange from $vSlides. @extended is set to the COM error code returned
4 - $vSlides has invalid format
Remarks: The SlideRange parameter $vSlides can be defined using one of the following formats:
* collection of individual slides:
- SlideRange object
- Index number of the first and last slide separated by a hyphen e.g. 1-3 or 1-* (* represents the last slide)
- Index number: -1 (SlideRange consists of all selected slides)
- Zero based array holding the index numbers or names of the slides
* collection of all slides:
- Slides object
- Index number: 0 (SlideRange consists of all slides)
* single slide:
- Slide object
- Index number
- Slide name
Author: water
_PPT_SlideShow
Set properties for a slide show and run the show.
Parameters:
$oPresentation - Presentation object.
$bRun (Optional) - If True then the function starts the slide show (default = True).
$vStartingSlide (Optional) - Name or index of the first slide to be shown (default = 1).
$vEndingSlide (Optional) - Name or index of the last slide to be shown (default = keyword Default = the last slide in the presentation).
$bLoop (Optional) - If True then the slide show starts again when having reached the end (default = True).
$iShowType (Optional) - Type of slide show defined by the PpSlideShowType enumeration (default = $ppShowTypeKiosk).
Return Value:
Success - the slidewindow object when $bRun = True, else 1.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $vStartingSlide is a number and < 1 or > current number of slides
3 - $vEndingSlide is a number and < 1 or > current number of slides
4 - Error occurred when running the slide show. @extended is set to the COM error code returned by the Run method
Author: water
_PPT_TableGet
Read data from a PowerPoint Table Shape to an Array.
Parameters:
$oPresentation - Object of the presentation to process.
$vSlide - Slide to process.
$vShape - Shape to process on $vSlide. See Remarks.
When set to 0 the first Table Shape on the Slide will be processed (default).
Return Value:
Success - A two-dimensional zero based array holding the values of the Table Shape.
Failure - "" and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Specified Shape is not a Table Shape or no Table Shape could be found
Author: water
_PPT_TableSet
Write data to a PowerPoint Table Shape.
Parameters:
$oPresentation - Object of the presentation to process.
$vSlide - Slide to process.
$vShape - Shape to process on $vSlide. See Remarks.
When set to 0 the first Table Shape on the Slide will be processed.
$aDataArray - 1D or 2D array to write to $vShape.
$iTableStartRow (Optional) - First row (starting with 1) of the Table Shape to write $aDataArray to (default = 1).
$iTableStartCol (Optional) - First column (starting with 1) of the Table Shape to write $aDataArray to (default = 1).
$iDataStartRow (Optional) - First row (starting with 0) of $aDataArray to write to the Table Shape (default = 0).
$iDataStartCol (Optional) - First column (starting with 0) of $aDataArray to write to the Table Shape (default = 0).
Return Value:
Success - 1.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $aDataArray has to be a 1D or 2D array
3 - Specified Shape is not a Table Shape or no Table Shape could be found
Remarks: If $aDataArray exceeds the size of the Table Shape $aDataArray will be truncated without raising an error.
Author: water
_PPT_TextFindReplace
Find & replace text on a single or selected slides.
Parameters:
$oPresentation - Object of the presentation to process.
$sFindText - The text to be searched for.
$sReplaceText - The replacement text. To delete found text use an empty string ("").
$vSlides (Optional) - Slides to process. See Remarks (default = 0 = all Slides).
$vShapes (Optional) - Shapes to process on each selected Slide. See Remarks (default = 0 = all Shapes).
$iOccurrence (Optional) - Number of times to replace $sFindText in a TextFrame (default = 0 = all occurrences).
$bMatchCase (Optional) - Determines whether a distinction is made on the basis of case (default = False).
$bWholeWords (Optional) - Determines whether only whole words are found (default = False).
Return Value:
Success - 1, @extended holds the number of successfully performed replacements.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - $sFindText is empty
3 - Error occurred creating the SlideRange from $vSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
4 - Error occurred creating the ShapeRange from $vShapes. @extended is set to the error code returned by _PPT_ShapeRangeSet
5 - Number of Slides is > 1 but $vShapes is not one of the allowed values: 0, >0 or a string
Remarks: With this function you can delete a single Shape from multiple Slides or multiple Shapes from a single Slide.
;+
Parameter $vSlides: See _PPT_SlideRangeSet for the format of this parameter
Parameter $vShapes:
If Number of Slides is = 1: All values for _PPT_ShapeRangeSet are valid. See _PPT_ShapeRangeSet for the format of this parameter
If Number of Slides is > 1: only 0 (all Shapes), integer (ID of the Shape) or a string (Name of the Shape) are valid
;+
While looping through the Shapes of a Slide errors are ignored and processing continues with the next Shape.
Author: water
_PPT_TextSet
Set the Text of a Shape or Shapes of a single or multiple Slides.
Parameters:
$oPresentation - Object of the presentation to process.
$sText - Text to insert into the Shapes.
$vSlides (Optional) - Slides to process. See Remarks (default = 0 = all Slides).
$vShapes (Optional) - Shapes to process on each selected Slide. See Remarks (default = 0 = all Shapes).
$iFlag (Optional) - This flag specifies how to process the Text:
0 - Replace the existing Text in the Shape (default).
1 - Prepend the Text to the existing Text in the Shape.
2 - Append the Text to the existing Text in the Shape.
Return Value:
Success - 1, @extended holds the number of processed Shapes.
Failure - 0 and sets @error.
1 - $oPresentation is not an object or not a presentation object
2 - Number of Slides is > 1 but $vShapes is not one of the allowed values: 0, >0 or a string
3 - Error occurred creating the SlideRange from $vSlides. @extended is set to the error code returned by _PPT_SlideRangeSet
4 - Error occurred creating the ShapeRange from $vShapes. @extended is set to the error code returned by _PPT_ShapeRangeSet
5 - $iFlag is invalid. Has to be >= 0 and <= 2
Remarks: With this function you can set the text of a single Shape of multiple Slides or multiple Shapes of a single Slide.
;+
Parameter $vSlides: See _PPT_SlideRangeSet for the format of this parameter
Parameter $vShapes:
If Number of Slides is = 1: All values for _PPT_ShapeRangeSet are valid. See _PPT_ShapeRangeSet for the format of this parameter
If Number of Slides is > 1: only 0 (all Shapes), integer (ID of the Shape) or a string (Name of the Shape) are valid
;+
While looping through the specified Slides all specified Shapes are modified. Errors are ignored and processing continues with the next Shape or Slide.
Author: water
_PPT_VersionInfo
Returns a string holding version/date of the PowerPoint UDF.
Parameters:
None
Return Value:
Success - string holding version/date of PowerPoint.au3.
Remarks: Example of the returned string: "PowerPoint: 1.0.0.0 2020-09-01"
Author: water