Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Long Documents / November 2003

Tip: Looking for answers? Try searching our database.

Incorrect Anchor to Shape relative position

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc - 13 Nov 2003 01:21 GMT
If a shape is inserted in word using either relative to
paragraph or relative to character setting and the shape
is above the anchor, the anchor moves to the right of the
shape but Shape.Top and Shape.Left fails to indicate this
change, as a result, calculating the position of the shape
on the page returns an incorrect value.

For example:

- Start with an empty word document
- Insert Picture from file
- Format Picture (right click) -> Layout -> Square
- Drag the image in the middle of the blank page
- Display the paragraph/formating characters

ok, so when you click on the picture, you should see its
anchor at the top/left of the page.

At this point, if you try:

ActiveDocument.Shapes(1).Left and .Top, you'll get a
correct value.

Move the shape closer and closer to its anchor and the
value gets closer to (0,0).

Now move the picture directly on the top/left corner of
the margins, where the anchor is. The anchor moves right.

The values returned are (0,0) BUT the anchor has moved and
if you call :

hr = pAnchor->get_Information
(Word::wdHorizontalPositionRelativeToPage,&vHPos);
hr = pAnchor->get_Information
(Word::wdVerticalPositionRelativeToPage,&vVPos);

you get the NEW anchor position. Adding the two together
returns an incorrect result, telling me that the shape is
where the Anchor is which is not true.

By the way, you can reproduce this bug within Word itself
very easily. As the picture is at teh top left corner and
the anchor is right of it, right click the picture, select
Format Picture, Layout Tab, Advanced, and change the 'To
the right of' and 'Below' settings to 'Margin'. Press
OK/OK and ... the picture moves to the right. Even word
thinks gets it wrong.

The real question is:

I need a formula that return the correct picture postion
relative to either the margins or the page corners.

Thanks
Cindy M  -WordMVP- - 17 Nov 2003 17:36 GMT
Answer recieved in one of the word.vba newsgroups

Cindy Meister
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.