Saturday, April 21, 2012 11:48 PM
I need to read /write all texts in PPT presentations.
All goes well except for shapes (mostly tables) inside placeholder objects.
I've been trying to find out how to manipulating shapes inside placeholder shapes, but without success.
The closest post I've seen to my problem is
Mr. Otaku suggested using
SmartArtQuickStyleto get at the object inside the placeholder, but all the documentation I looked at for
SmartArtQuickStyle have me no clue.
Could someone please give me a clue?
Thanks so much,
Sunday, April 22, 2012 4:57 PM
PPT 2007 and later have the ContainedType property on the PlaceholderFormat which will tell you what type of shape is contained within the placeholder. Once you know what type is contained then the rest of the processing is just like any other shape.
Assuming shp has a reference to a placeholder shape then the line below will give you info on the type within it
To give you a better understanding:
Dim shp As Shape
Dim sld As Slide
Set sld = ActivePresentation.Slides(1)
' Look for placeholders containing tables on the 1st slide of the presentation
For Each shp In sld.Shapes.Placeholders
If shp.PlaceholderFormat.ContainedType = msoTable Then
'If we find one pass the shape reference to the routine that is enumerating the text
Sub EnumerateTableText(shp As Shape)
Dim row As Long
Dim column As Long
For row = 1 To shp.Table.Rows.Count
For column = 1 To shp.Table.Columns.Count
Debug.Print shp.Table.Cell(row, column).Shape.TextFrame2.TextRange.Text
Regards, Shyam (http://skp.mvps.org)