Example, in Powerpoint:
Represents the text frame in a Shape object. Contains the text in the text frame and the properties and methods that control the alignment and anchoring of the text frame.
Represents the text frame in a Shape or ShapeRange object. Contains the text in the text frame and exposes properties and methods that control the alignment and anchoring of the text frame.
So TextFrame2 also refers to ShapeRange
object, and it has a few more properties than TextFrame.
I am not really sure when or whether I should use one or the other, for example, to manipulate the text values held in Table cells on a powerpoint slide. Both seem to work, and the following statement returns TRUE
.
Dim tbl as Table
Set tbl = ActivePresentation.Slides(1).Shapes("Table1").Table
tbl.Cell(r, c).Shape.TextFrame2.TextRange.Characters.Text = _
tbl.Cell(r, c).Shape.TextFrame.TextRange.Characters.Text
Is there some definitive guide on when I should use TextFrame
vs when I should use TextFrame2
?
According to Jon Peltier here: http://peltiertech.com/programming-excel-2007-2010-autoshapes-with-vba/
"The TextFrame2 member was added in Excel 2007 and gives better control over the formatting of the text. Because it is not backward compatible, I would recommend using the TextFrame object"
I'm guessing a similar situation applies in PPT.