Log in

View Full Version : text from shape at specific location



jonofisher
05-16-2008, 04:18 AM
Hello

I am trying to do something which i thought would be simple, but cannto work out how to do it.

I simply want to have a variable which is the text from a slide at a specific location.
ie Varx = sld.shape(left=50,top=100).text

Can i somehow select that shape and location (that example above doesnt work) without having to loop through all shapes on the page (thats the only way i currently know how to do it - loop through, and then add if left = x and top = x, then...

Hope this makes sense.

Thanks

Jfish

John Wilson
05-16-2008, 09:21 AM
It makes sense but if you use left and top you will have to loop through the shapes. Another problem will be that the slightest move of the shape and it will fail!

There are several alternatives:

Try naming the shape (easy in 2007) or in other versions

Sub nameme()
ActiveWindow.Selection.ShapeRange(1).Name = "myshape"
End Sub

And then:

var= ActivePresentation.Slides(xx).Shapes("myshape").TextFrame.TextRange

jonofisher
05-19-2008, 01:15 AM
john - thanks. i will give that a try. i have got the code working but it is taking a little while to run due to the looping method i am currently using, so will try and adapt with your suggestion. cheers