In article <B3E65337-C13C-4E45-9CEB-F9F8352FD1EA.TakeThisOut@microsoft.com>, Avivit
Bercovici wrote:
> Hi,
> 3 short questions:
> 1. If I get a Shape as a parameter to a method, how can I know which slide
> does it belong to?
The shape's .Parent property will return the slide the shape is on:
Function HoosierDaddy (oSh as Shape) as Slide
Set HoosierDaddy = oSh.Parent
End Function
It's not quite that simple really ... .Parent returns the shape's "container"
which might also be a notes page, a master, layout, etc. If that's a concern:
Function HoosierDaddy (oSh as Shape) as Object
Set HoosierDaddy = oSh.Parent
End Function
Then use a Select Case on Typename(HoosierDaddy(oSh)) to decide what to do
next.
> 2. How can I compare 2 shapes. I tried to use ReferenceEquals but it doesn't
> work if they are from different shape ranges (for example due to selections).
Compare in what way? What do you need to determine? Whether you have two
references to the same shape?
Make sure they're on the same slide first, then compare their ShapeID property.
> 3. Is there a unique property to shape (or a unique identifier)?
See above. The shape's .Name should be unique in theory; in practice, PPT bugs
make it unreliable.
> I'm using PP 2007.
My sympathies.
==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/
PPTools add-ins for PowerPoint
http://www.pptools.com/