Shapes.AddPlaceholder Method
Restores a previously deleted placeholder on a slide. Returns a CanvasShapes object that represents the restored placeholder.
Namespace: Microsoft.Office.Interop.PowerPoint
Assembly: Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)
Syntax
'Declaration
Function AddPlaceholder ( _
Type As PpPlaceholderType, _
Left As Single, _
Top As Single, _
Width As Single, _
Height As Single _
) As Shape
'Usage
Dim instance As Shapes
Dim Type As PpPlaceholderType
Dim Left As Single
Dim Top As Single
Dim Width As Single
Dim Height As Single
Dim returnValue As Shape
returnValue = instance.AddPlaceholder(Type, _
Left, Top, Width, Height)
Shape AddPlaceholder(
PpPlaceholderType Type,
float Left,
float Top,
float Width,
float Height
)
Parameters
- Type
Type: Microsoft.Office.Interop.PowerPoint.PpPlaceholderType
The type of placeholder. Placeholders of type ppPlaceholderVerticalBody or ppPlaceholderVerticalTitle are found only on slides of layout type ppLayoutVerticalText, ppLayoutClipArtAndVerticalText, ppLayoutVerticalTitleAndText, or ppLayoutVerticalTitleAndTextOverChart. You cannot create slides with any of these layouts from the user interface; you must create them programmatically by using the Add method or by setting the Layout property of an existing slide.
- Left
Type: System.Single
The position (in points) of the upper-left corner of the placeholder relative to the upper-left corner of the document.
- Top
Type: System.Single
The position (in points) of the upper-left corner of the placeholder relative to the upper-left corner of the document.
- Width
Type: System.Single
The width of the placeholder, in points.
- Height
Type: System.Single
The height of the placeholder, in points.
Return Value
Type: Microsoft.Office.Interop.PowerPoint.Shape
Shape
Remarks
If more than one placeholder of a specified type has been deleted from the slide, the AddPlaceholder method will add them back to the slide, one by one, starting with the placeholder that has the lowest original index number.
Examples
Suppose that slide two in the active presentation originally had a title at the top of the slide that's been deleted, either manually or with the following line of code.
ActivePresentation.Slides(2).Shapes.Placeholders(1).Delete
This example restores the deleted placeholder to slide two.
Application.ActivePresentation.Slides(2) _
.Shapes.AddPlaceholderppPlaceholderTitle