X-Y of Selection

J

John

Hi there,

Can anyone tell me how to get and set the X-Y co-ordinates of a temporary
selection? I've tried grouping and then using the SetCenter method, but is
there a way without grouping?

Thanks

John
 
J

junethesecond

It may be possible with Cells property, as
X=ActiveWindow.Selection(1).Cells("PinX")
Y=ActiveWindow.Selection(1).Cells("PinY")

Pinx and piny are usually in the center of a shape, but sometimes they are
not in the center. If not, you might have to culculate center using other
cells' values, width, height, locpinx, lockpiny...
 
J

John

Hi June,

Thanks for this. Do you mean that you could find the xy of each shape and
then calculate the centre from that?

I was really hoping to avoid too much calculation and that the selection
boundary might have its own co-ordinates, but perhaps not?

Thanks again

John
 
C

Chris Roth [ Visio MVP ]

Use Selection.Bounding box. You'll get the left, top, bottom, right of the
selection in page coordinates, then you can do the math. You can then do
Move or SetCenter on the Selection, I believe.

--

Hope this helps,

Chris Roth
Visio MVP
 
J

John

Hi Chris,

That's great, just what I was after.

By the way, did you have a chance to have a look at the crossing connector
file (.vsd) I sent over?

Thanks

John
 

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