changing relative position 
Author Message
 changing relative position

Hello,
  I have this problem, basically I need to PROGRAMATICALLY
go though hundreds of docs and ensure the all Shape
objects have their relative positions types , both hort
and vert, set to the Page option.
   The problem is this, when i do this line of code
oWordShape.RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage

it changes the position to Page but it also moves the
Shape.
   If the old position type was relative to Column and it
was -2" then the new position relative the the Page will
be -2".  The ends up hiding the Shape in lala-land.

The wierd thing:
If you create a new document and add a bunch of rectangle
shapes, the shape I'm dealing with, set all their relative
positions types to either Column or Paragraph and then run
the above line of code in a loop it will change the
relative position type to Page but NOT move the object.
  In otehr words it somehow computes to new distances to
be relative to the Page and uses that new distance in
order to not move the Shape.

Another wierd thing- If I manually changes the relative
position type to Page it will perform the calculations for
distance and does not move the shape.  Manually doing this
for hundreds of docs with many shapes per doc is not an
option!!!

I've looked at the properties of my Shapes and I can see
no difference to those I created on the fly.

Any ideas on how to change the relative position type of
my Shapes to Page without actually moving the Shape?

If you want I can send you one page of a doc where this
happens, email me at the above address.

Thanks,

Mike



Sat, 29 Jan 2005 22:38:12 GMT  
 changing relative position

I hate shapes. They are terribly inconsistent and difficult to work
with. I would read its bounding x,y first (.top and .left), do the
{*filter*}, err the Relative in a Horizontal Position thingo, and then
reset the .top and .left to before. Then I'd lock the anchor and
sacrifice at least 2 goannas and a koala bear chanting "Sateg Llib",
"Sateg Llib".


like this:

Quote:
>Hello,
>  I have this problem, basically I need to PROGRAMATICALLY
>go though hundreds of docs and ensure the all Shape
>objects have their relative positions types , both hort
>and vert, set to the Page option.
>   The problem is this, when i do this line of code
>oWordShape.RelativeHorizontalPosition =
>wdRelativeHorizontalPositionPage

>it changes the position to Page but it also moves the
>Shape.
>   If the old position type was relative to Column and it
>was -2" then the new position relative the the Page will
>be -2".  The ends up hiding the Shape in lala-land.

>The wierd thing:
>If you create a new document and add a bunch of rectangle
>shapes, the shape I'm dealing with, set all their relative
>positions types to either Column or Paragraph and then run
>the above line of code in a loop it will change the
>relative position type to Page but NOT move the object.
>  In otehr words it somehow computes to new distances to
>be relative to the Page and uses that new distance in
>order to not move the Shape.

>Another wierd thing- If I manually changes the relative
>position type to Page it will perform the calculations for
>distance and does not move the shape.  Manually doing this
>for hundreds of docs with many shapes per doc is not an
>option!!!

>I've looked at the properties of my Shapes and I can see
>no difference to those I created on the fly.

>Any ideas on how to change the relative position type of
>my Shapes to Page without actually moving the Shape?

>If you want I can send you one page of a doc where this
>happens, email me at the above address.

>Thanks,

>Mike

Steve Hudson -- Word Heretic, Sydney, Australia
"Player One needs work... badly."
{*filter*} teacher, trainer, tutor, writer, developer

You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Sun, 30 Jan 2005 09:05:50 GMT  
 changing relative position

I hate shapes. They are terribly inconsistent and difficult to work
with. I would read its bounding x,y first (.top and .left), do the
Relative in a Horizontal Position thingo, and then reset the .top and
.left to before. Then I'd lock the anchor and sacrifice at least 2
goannas and a koala bear chanting "Sateg Llib", "Sateg Llib".


like this:

Quote:
>Hello,
>  I have this problem, basically I need to PROGRAMATICALLY
>go though hundreds of docs and ensure the all Shape
>objects have their relative positions types , both hort
>and vert, set to the Page option.
>   The problem is this, when i do this line of code
>oWordShape.RelativeHorizontalPosition =
>wdRelativeHorizontalPositionPage

>it changes the position to Page but it also moves the
>Shape.
>   If the old position type was relative to Column and it
>was -2" then the new position relative the the Page will
>be -2".  The ends up hiding the Shape in lala-land.

>The wierd thing:
>If you create a new document and add a bunch of rectangle
>shapes, the shape I'm dealing with, set all their relative
>positions types to either Column or Paragraph and then run
>the above line of code in a loop it will change the
>relative position type to Page but NOT move the object.
>  In otehr words it somehow computes to new distances to
>be relative to the Page and uses that new distance in
>order to not move the Shape.

>Another wierd thing- If I manually changes the relative
>position type to Page it will perform the calculations for
>distance and does not move the shape.  Manually doing this
>for hundreds of docs with many shapes per doc is not an
>option!!!

>I've looked at the properties of my Shapes and I can see
>no difference to those I created on the fly.

>Any ideas on how to change the relative position type of
>my Shapes to Page without actually moving the Shape?

>If you want I can send you one page of a doc where this
>happens, email me at the above address.

>Thanks,

>Mike

Steve Hudson -- Word Heretic, Sydney, Australia
"Player One needs work... badly."
{*filter*} teacher, trainer, tutor, writer, developer

You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Sun, 30 Jan 2005 09:35:46 GMT  
 changing relative position
Steve,
  Here is an example shape:
   Hort 1.56"  from Column
   Vert 6.25"  from Paragraph

When it get .top and .left it gives me InchesToPoints
values for the above numbers.
When I change the relative positions with code to Page for
both Hort and Vert it looks like this
   Hort 1.56"  from Page
   Vert 6.25"  from Page

and the .top and .left are the same values as before.

This has the effect of moving the shape.

When I manually change the Relative postions I get this
   Hort 2.81"  from Page
   Vert 15.39"  from Page

and the .top and .left values reflect this change too.

Doing it by code is not the same as by hand!!!

Mike

Quote:
>-----Original Message-----

>I hate shapes. They are terribly inconsistent and
difficult to work
>with. I would read its bounding x,y first (.top
and .left), do the
>Relative in a Horizontal Position thingo, and then reset
the .top and
>..left to before. Then I'd lock the anchor and sacrifice
at least 2
>goannas and a koala bear chanting "Sateg Llib", "Sateg
Llib".



Sun, 30 Jan 2005 21:32:04 GMT  
 changing relative position
G'day again Mike,

ah ha! Well explained. I forgot that the anchor moving business would
get into the road. Yes, I am fully aware that code is way different
than by hand <shudders> - I intentionally limit my scope usually...

What about this. Before we change the link, we examine how far from
top of page the range the anchor is in and then add this to the Y of
the new picture position? If X changes it'll be constant based on
margin size or a percentage thereof.

Looking forward with interest to your results.


like this:

Quote:
>Steve,
>  Here is an example shape:
>   Hort 1.56"  from Column
>   Vert 6.25"  from Paragraph

>When it get .top and .left it gives me InchesToPoints
>values for the above numbers.
>When I change the relative positions with code to Page for
>both Hort and Vert it looks like this
>   Hort 1.56"  from Page
>   Vert 6.25"  from Page

>and the .top and .left are the same values as before.

>This has the effect of moving the shape.

>When I manually change the Relative postions I get this
>   Hort 2.81"  from Page
>   Vert 15.39"  from Page

>and the .top and .left values reflect this change too.

>Doing it by code is not the same as by hand!!!

>Mike

>>-----Original Message-----

>>I hate shapes. They are terribly inconsistent and
>difficult to work
>>with. I would read its bounding x,y first (.top
>and .left), do the
>>Relative in a Horizontal Position thingo, and then reset
>the .top and
>>..left to before. Then I'd lock the anchor and sacrifice
>at least 2
>>goannas and a koala bear chanting "Sateg Llib", "Sateg
>Llib".

Steve Hudson -- Word Heretic, Sydney, Australia
"Player One needs work... badly."
{*filter*} teacher, trainer, tutor, writer, developer

You agree by writing to me personally that any material can be reused publicly unless you explicitly disclaim it. (For List and blog use.)


Mon, 31 Jan 2005 09:35:39 GMT  
 changing relative position
Steve,
  To get to position of the shape's anchor I used the
information method like so,
  lHort = oShape.Anchor.Information
(wdHorizontalPositionRelativeToPage)

The problem is lHort always comes back as -1, the vertical
is good it comes back as a positive number.  As I
understand it -1 is VB's way of saying I don't know.
Does this mean the anchor is off the page?

But when I do this I get negative numbers
  lHort = oShape.Anchor.ShapeRange.Top

Which should I be using to offset the shapes movement?
Thanks,

Mike

Quote:
>-----Original Message-----
>G'day again Mike,

>ah ha! Well explained. I forgot that the anchor moving
business would
>get into the road. Yes, I am fully aware that code is way
different
>than by hand <shudders> - I intentionally limit my scope
usually...

>What about this. Before we change the link, we examine
how far from
>top of page the range the anchor is in and then add this
to the Y of
>the new picture position? If X changes it'll be constant
based on
>margin size or a percentage thereof.

>Looking forward with interest to your results.



Mon, 31 Jan 2005 23:17:49 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Position of a new form relative to a control

2. How do I use relative position of cursor rather than cell ref in Excel 97 macro

3. Relative Position

4. Displaying forms in relative position

5. Positioning Forms relative to other forms

6. Relative VBS/JScript position causing erros

7. Relative Positioning of Modal Popup

8. Setting modal form position relative to parent

9. relative/absolut position of fields

10. Relative position in an index.

11. Positioning a form relative to a control

12. How to store relative position

 

 
Powered by phpBB® Forum Software