-3

I am looking for information to help me better understand ".TextFrame" and ".TextRange" objects in PowerPoing VBA. Can anybody help? I have reviewed the stuff on MSDN and am just continually disappointed with the documentation there.

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • Please look at the help center and what is [on topic](http://stackoverflow.com/help/on-topic) for Stack Overflow - this question is _off-topic_ as it is asking to recommend a book, tool, or software library. – SierraOscar Jan 22 '16 at 16:02
  • I've edited your question to better fit the site guidelines as Steve Rindsberg's reply is important information for the site that should not be lost. I believe it also answers your real question... – Cindy Meister Jan 22 '16 at 17:09
  • Thank you, @CindyMeister – Steve Rindsberg Jan 22 '16 at 17:50

1 Answers1

1

Shapes are the basic building blocks for PPT slides, masters, layouts, notes pages; everything on them is a shape.

Some shapes (lines for example) can't contain text. Those that can contain text have a TextFrame. If a Shape.TextFrame contains text, then you can use Shape.TextFrame.TextRange to get access to (set/read) the properties of all of the text in the TextFrame. Other methods also return a .TextRange that may be some subset of the text within the .TextFrame.

Simple example:

Sub DoSomethingUseless()

Dim oSh as Shape
Dim oSl as Slide

For Each oSl in ActivePresentation.Slides

For Each oSh in oSl.Shapes
   If oSh.HasTextFrame Then
      If oSh.TextFrame.HasText Then
         Debug.Print oSh.TextFrame.TextRange.Text
      End If
   End If
Next   ' Shape

Next   ' Slide

End Sub
Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34