Loop through types of shapes

G

Guest

I'm trying to export some information from a PPT file to a text file. I want
something like this:

For each slide:
Get the slide index (I can do this part)
Get the slide title (I can do this part)
Loop through all of the shapes on the slide and:
(1) For each shape.Type = msoPicture, get the Alternative Text property
(2) For each shape.PlaceholderFormat.Type = ppPlaceholderBody get the Text
property

(My problem is that some slides have more than one shape.Type = msoPicture.
I don't know how to separate the two types of shapes so that I get all of the
pictures and still only get the body text once.)

Build a tab-separated string with each piece of information for each slide
separated by a line return. (I can do this part.)
Export all of this text to a text file. (I can do this part.)

Any suggestions?

(Can I accomplish this by looping through the shapes on the slide view for
each slide and then switching to notes page view to get the body text? Does
the current view matter?)
 
S

Steve Rindsberg

I'm trying to export some information from a PPT file to a text file. I want
something like this:

For each slide:
Get the slide index (I can do this part)
Get the slide title (I can do this part)
Loop through all of the shapes on the slide and:
(1) For each shape.Type = msoPicture, get the Alternative Text property
(2) For each shape.PlaceholderFormat.Type = ppPlaceholderBody get the Text
property

(My problem is that some slides have more than one shape.Type = msoPicture.
I don't know how to separate the two types of shapes so that I get all of the
pictures and still only get the body text once.)


Something like this: (VBA won't ignore the typing errors;
you'll have to do that for it <g>)

For Each oSh in oSl.Shapes
If oSh.PlaceholderFormat.Type = ppPlaceholderBody
' do your stuff
Else
If oSh.Type = msoPicture
' do your other stuff
End If
End If
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top