Coordinates of two endpoints of a line segment

northwolves

Well-known Member
Joined
Jun 21, 2006
Messages
1,128
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
  6. 2007
  7. 2003 or older
Platform
  1. Windows
Any one knows how to use VBA to get the coordinates of two endpoints of a line segment in a worksheet? Million thanks.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Any one knows how to use VBA to get the coordinates of two endpoints of a line segment in a worksheet?
When you say "line segment", do you mean a Line Shape?

How did you want an end point returned to you... as a single text string like (12,34) or as two separate numbers in two separate cells?
 
Upvote 0
Thanks for your reply. We use the example from MSDN:

Code:
Set myDocument = Worksheets(1) 
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line 
 .DashStyle = msoLineDashDotDot 
 .ForeColor.RGB = RGB(50, 0, 128) 
End With

Then we get a shape line. when we save and reopen the document, how can we get the coordinates of two endpoints(10,10),(250,250) by codes?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top