Locating a Shape in PowerPoint VB

G

Guest

How can I locate a specific textbox or shape on each slide in my
presentation. I want to find the shape and change the value of each textbox.
The textbox will be located in the same position on each slide and I would
like to be able to change it automatically.

Thanks
 
G

Guest

If I understand what you want to do, something like this should do the trick
(untested so use with caution and watch for line breaks):

Sub FindMyShape()
Dim oShp As Shape
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Left = 100 And oShp.Top = 200 Then 'is it in the right
spot
If oShp.HasTextFrame Then 'make sure it is a text box
oShp.TextFrame.TextRange.Text = "This is it!"
End If
End If
Next oShp
Next oSld
End Sub

Just change the numbers (100 and 200) to the exact spot of your text box,
and change the "This is it!" line to whatever you want to do with the text
boxes in that location. Note that this only works if the text boxes are in
exactly the right place. Close does not count.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

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