question

SOMESHJHAWAR-3053 avatar image
0 Votes"
SOMESHJHAWAR-3053 asked VikiJi-MSFT edited

Excel VBA Line Shape (Ver 2003) and (Ver2019)

Hello,

In earlier version of VBA Excel (2003), the nodes property exist for Line shapes.
So, to get the start and end point's co-ordinates of any shape(created earlier), we can get it from "Shape.Nodes(1).points" and "Shape.Nodes(2).points.

But in new version (2019), there is no nodes for line shape.
How to get the co-ordinates of line now?

In my following Example, I created 2 lines:
ActiveSheet.Shapes.AddLine(50,50,200,200) (looks like "\")
ActiveSheet.Shapes.AddLine(50,200,200,50) (looks like "/")

Now for both the shapes, the output of shape.left, .top, .width, .height , .horizontalFlip, .VerticalFlip are same.
So , now how we can get the co-ordinates for both the lines?

Thanks,
Somesh

not-supported
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

in my question, earlier by mistake of copy-paste, I said that both the lines have same vertical and horizontal flip values.
Actually, there verticalFlip value is different.

0 Votes 0 ·
SOMESHJHAWAR-3053 avatar image
0 Votes"
SOMESHJHAWAR-3053 answered

I am posting a Table image, which can help to understand the orientation of line, by the value of Horizontal and Vertical Flip.
In my Question , i get same result in Flips value of both lines because of copy-paste (taking shape 1 flip value, in place of shape 2 flip values) in output.

Short form used in this tables are :
Column from->To : T=Top, L=Left, B=Bottom, R= Right
Column X1, first parameter in addline method
column Y1, second parameter in addline method
Column X2,third parameter in addline method
Column Y2, forth parameter in addline method

Column Hf= HorizontalFlip value of Shape
column Vf=VerticalFlip value of Shape

So, i need to write some more code, to get the X1,Y1 and X2,Y2 for any line, by using Hf and Vf values of Shape.
I hope , it will help to re-use my Code of 2003 version in , new excel version.



107633-image.png




My, suggestion to Microsoft, Please keep a logbook, in which you can keep a change details from your previous version to new version.
Also keep a turnaround solution detail, so people can use there work in advance version also.


image.png (13.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

VikiJi-MSFT avatar image
0 Votes"
VikiJi-MSFT answered

@SOMESHJHAWAR-3053,
As the tag office-excel-itpro focuses on general issues about Excel client, but your issue is more related to code, to better help you, I would suggest you post a new question on the following forum.

Office developer community

Thanks for your understanding.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.