adjust end point of a line to a new x position

Started by matthew, August 20, 2020, 01:53:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

matthew

Hi,

For the life of me I can't work out how to adjust an existing line by moving it's end point to a new coordinate.
Been trying ActivePage.Line but doesn't work:

        Set vsoShape1 = Documents(1).Pages(1).Shapes(Band(eachgroup, 6))
        vsoShape1 = ActivePage.Line(xmaxstart, Band(eachgroup, 1), Band(eachgroup, 8), Band(eachgroup, 1)) '( _xBegin_ , _yBegin_ , _xEnd_ , _yEnd_ )

'DrawLine' will draw a new line to the correct position but I want to adjust the existing one.

Any advice please?

thanks
Matthew

Surrogate

As first you must know target shape's ID, this code in example for ID = 333
Dim shpLine As Shape
Set shpLine = ActivePage.Shapes(333)
shpLine.Cells("EndX").Formula = "0 mm"
shpLine.Cells("EndY").Formula = "0 mm"


Yacine

#2
To enhance Surrogate's answer:
There are different ways to identify a shape:

- by selecting it manually --> set myShp = activewindow.selection(1)
- by selecting it manually and looking for its ID - eg in the size window or in the shapesheet window, then you can address it as in Surrogates post.
- by renaming it - in the developer tab there is a "name" button --> "myLine" --> activepage.Shapes("myLine")

- If the line is newly created you can use the return value of the function - eg: set myShp = activepage.drawline(...
Yacine

matthew

many for the advice, my application is now doing what I hoped!  Thanks to you both.
kind regards
Matthew