how to tell if an object is on a slide

G

Guest

I'm trying to determine if there's a reliable way to determine if a
particular object is on a slide.

By right-clicking on a particular shapes/object and choosing "Format [text
box/picture/etc.]" and then selecting the "Position" tab, I thought I was on
the right track, but for whatever reason, objects that are definitely on the
slide are reporting negative Left and/or Top values, and there doesn't seem
to be any pattern I can determine that would lead me to say something like
"values greater than -2 will always be on the slide," etc.

Does anyone know of a reliable way to determine if something really is on
the slide?

Here's what I tried, but it sometimes incorrectly skips over shapes/objects
that really are on the slide:

' get slide values so we can tell if shapes are on or off the slide
With oPres.PageSetup
sSlideWidth = .SlideWidth
sSlideHeight = .SlideHeight
End With

' oShp is a Shape variable that looks at each shape on the slide
With oShp
' measure Left position to determine shape's left/right orientation
If .Left > 0 And .Left < sSlideWidth Then
' now measure Top position to determine
' shape's top/bottom orientation
If .Top > 0 And .Top < sSlideHeight Then
' do stuff here if the Left and Top values
' meet the measurement criteria above
 
D

David M. Marcovitz

I think the problem might be that you don't have a good definition of
what it means for an object to be on the slide. I think you are running
into problems where the object is partially on the slide. If oShp.Left is
-5 and oShp.Width is 100, then 95% of the width of the object is on the
slide. The same idea applies for oShp.Top and oShp.Height as well as
objects falling off the right and bottom of the screen.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
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