Determine the BeginX, BeginY, EndX and EndY for an existing line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyong know how to determine the BeginX, BeginY, EndX and EndY for an
existing line? I am recreating an slide and I want to add a line in the same
position as another slide. I can get the top, left, width and height but
these don't give the correct results when using with the AddLine method.

Thanks,
 
Try clicking on Insert, Duplicate Slide to create a duplicate slide with the
line in place for you.

You can also select the line, click on format, Autoshape, Position and make
note of the positions. Then copy and paste the same line to the next slide.
 
You can either use simple math on the values you have or just let this do it
for you.

Sub liner()
On Error GoTo errhandler
With ActiveWindow.Selection.ShapeRange
If .Type = msoLine Then
MsgBox "Beginx = " & .Left & " Beginy = " & .Top & Chr$(13) _
& " Endx = " & (.Left + .Width) & " Endy = " & (.Top + .Height)
End If
End With
Exit Sub
errhandler:
MsgBox "Error did you select a line?"
End Sub
 
Brain has now booted. That vba wont always work (values correct but assigned
to wrong variable) depending on if the slope is positive or negative. You can
probably see where the maths is going though!
 
Back
Top