|PowerPoint tips, hints and tutorials that will change your presentations for ever!|
PowerPoint vba - End Co-ordinates of a Line
When you draw a line with vba you will specify the start and end co-rdinates x1,y1,x2 and y2.
However if you are given a predrawn line it is not obvious how to find those co-ordinates!
The first hint is to treat the line as having a bounding box.
It is then not too difficult to use the left, top, width and height to deduce the co-ordinates.
How do you know the line is not like this:
Clearly in this direction the co-ordinates of the ends will be completely different.
It's not obvious that the line has any property which will tell you the slope.
In the first example the bounding box has been drawn top left to bottom right. The "Normal" way! The box has two properties FlipHorizontal and FlipVertical. In the first "Normal" example both will be set to False.
The second example has been drawn from the bottom right and is considered to be vertically flipped. In this example FlipHorizontal will still be False but FilpVertical will be True.
If we draw the line (and therefore the bounding box) right to left then it is considered orizontally flipped.
There are therefore four combinations of VerticalFilp and Horizontal Flip which tell us in which direction the line was drawn and therefore how to deduce the co-ordinates.
This Function will tell you which direction the line was drawn and help you find the co-ordinates.
To Use the Function to Get the Direction of a Selected Line Use:
Free Microsoft PowerPoint Advice, help and tutorials, Template Links