Supercharge your PowerPoint productivity with

Supercharge your PPT Productivity with PPTools - Click here to learn more.

Tell me about PPTools

Get a reference to a placeholder on a slide


PPTools
Shape Styles brings the power of styles to PowerPoint. Apply complex formatting with a single click
Merge Excel, CSV or tab-delimited data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more
FixLinks prevents broken links when you distribute PowerPoint presentations
Optimizer saves disk space and bandwidth, shrinks your PowerPoint presentations to the right size for email, screenshow or printing
PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements
Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF
Image Export converts PowerPoint slides to JPG, PNG, GIF, WMF and more

Problem

Solution

This function returns a reference to the body text placeholder on a slide.
You can change it to return other placeholders instead.

Function BodyTextPlaceholder(oSl As Slide) As Shape
    Dim oSh As Shape
    For Each oSh In oSl.Shapes
        If oSh.Type = msoPlaceholder Then
            ' change ppPlaceholderBody to another placeholder type if you 
            ' want to get a reference to a different placeholder
            If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
                ' we found it
                Set BodyTextPlaceholder = oSh
                Exit Function
            End If
        End If
    Next    ' shape
End Function

You can use this macro to test the function:

Sub TestBodyTextPlaceholder()
    Dim oSl As Slide
    Dim oSh As Shape
    Set oSl = ActivePresentation.Slides(2)
    Set oSh = BodyTextPlaceholder(oSl)
    ' If there's no placeholder, the function returns nothing, so test:
    If Not oSh Is Nothing Then
        MsgBox oSh.TextFrame.TextRange.Text
    End If
End Sub

Search terms:placeholder,reference,body,text,title


Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2008 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese



Supercharge your PPT Productivity with PPTools


content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Get a reference to a placeholder on a slide
http://www.pptfaq.com/FAQ00681.htm
Last update 09 September, 2006