Function Reference

_PPT_TextSet

Set the Text of a Shape or Shapes of a single or multiple Slides.

#Include <PowerPoint.au3>
_PPT_TextSet($oPresentation, $sText[, $vSlides = 0[, $vShapes = 0]])

 

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.

 

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

; ***********************************************************************************************
; Prepend Text to the existing Text of Shape 1 on Slides 1 and 2
; ***********************************************************************************************
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_TextSet Example 1", "Presentation before Text is Set!", 5)
_PPT_TextSet($oPresentation, "TestText: " & @CRLF, "1-2", 1, 1)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_TextSet Example 1", "Error setting Text." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_TextSet Example 1", @extended & " Shapes modified in the specified range!")