VBA - dimension of a new line

Hello everybody,

at first sorry for my bad English. I hope you could understand what I mean.

My question:
How can I find out the starting point of a new line and their direction?

Background:
I'm trying to create a macro that helps drawing lines dimensionally accurate. It should be a little bit like CAD:  I want to start drawing, and then enter the exact length in numbers. Here is what I've done.


Private Sub Document_ShapeCreate(ByVal Shape As Shape)

Dim x As Double, y As Double, w As Double, h As Double, k As Double
Dim Length As Double, LengthNew As Double

Application.unit = cdrMillimeter

Shape.GetBoundingBox x, y, w, h
Debug.Print x, y, w, h

Length = Sqr(((w) ^ 2) + ((h) ^ 2))

LengthNew = InputBox("Insert length please!")

k = LengthNew / Length

'Shape.SetSize w * k, h * k (my first try)

Debug.Print "k"; k, "LengthNew"; LengthNew, "Length"; Length

Shape.SetBoundingBox x, y, w * k, h * k, , cdrBottomLeft
Debug.Print x, y, w * k, h * k

End Sub



The first problem is the direction of the line. If I start bottom left it works. Otherwise not...

The second problem is the unit. Although I set Application.unit = cdrMillimeter the program interpret my entry as inches.

And as third - but I guess not as last question: If I add a line to a polyline the macro does not start.

Or is this all the wrong way, could I determine the length "BeforeUpdate"?

Thank you for all your help.

Saitenclown

P.S. I'm sorry, but I didn't found how to insert Code into my post in the right way.