Find out current page of a shape object

L

LostBoyz69

I'm looping through all of the shape objects to charactorize them and
printing a report of the findings. The issue I have so far is that
inline pictures (non-ole) don't have a name or other distinguishing
info (that I see ATM). It would be much easier to have at least a page
number to reference.

So, how do I find out what page an object is on. I saw the
selection..... solution, but I don't have an active selection.... just
a shape object.

Thanks
 
J

Jay Freedman

I'm looping through all of the shape objects to charactorize them and
printing a report of the findings. The issue I have so far is that
inline pictures (non-ole) don't have a name or other distinguishing
info (that I see ATM). It would be much easier to have at least a page
number to reference.

So, how do I find out what page an object is on. I saw the
selection..... solution, but I don't have an active selection.... just
a shape object.

Thanks

If you're looping through the document and you're finding inline
shapes, you must be using the InlineShapes collection (which is
separate from the Shapes collection). For that, code like this works:

Dim ILS As InlineShape

For Each ILS In ActiveDocument.InlineShapes
MsgBox ILS.Range.Information(wdActiveEndPageNumber)
Next

Objects in the Shapes collection (floating graphics and textboxes)
don't have a .Range property, but they do have an .Anchor property
that returns a Range, and the shape must always be on the same page as
the anchor, so this works:

Dim Shp As Shape

For Each Shp In ActiveDocument.Shapes
MsgBox Shp.Anchor.Information(wdActiveEndPageNumber)
Next

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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