how to loop through shapes in powerpoint vba

V

vicky

hey i have a slide which contains different shapes . i need to loop
through all the shapes and check if any shape contains text. if a
shape contains text then i need grab the value of the text in a
variable.... i am newbie to vba.... this one really has me stumped....
 
J

Jarek Kujawa

one way (looks for text boxes among shapes in Slide 1):

Sub cus()
Dim shape As shape
Dim tekst as String
With ActivePresentation.Slides(1)
.Select
For Each shape In ActivePresentation.Slides(1).Shapes
'MsgBox shape.Name
If shape.Name Like "*Text Box*" Then
shape.Select
tekst = ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Words
End If
Next
End With

End Sub

HIH
 

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