Sub Macro1() Dim n As Node, x1 As Double, y1 As Double, x2 As Double, y2 As Double, os As ShapeRange ActiveDocument.Unit = cdrMillimeter Set os = ActiveSelectionRange If os.Count <> 1 Then MsgBox ("Select one shape and run macro again!"): Exit Sub ActiveShape.Curve.Nodes.First.GetPosition x1, y1 ActiveShape.Curve.Nodes.Last.GetPosition x2, y2 If x2 <> x1 Then k = -1 Else myangle = -90: GoTo here: With os(1) .RotationCenterX = x1 .RotationCenterY = y1 End With myangle = Atn((y2 - y1) / (x2 - x1)) * 180 / 3.14159265358979here: os(1).Rotate k * myangleEnd Sub
Hello. Is there a possibility to modify this code so that it can function on 2 marked nodes also in closed shapes?
Thx
You can perform that sort of precision rotation using this: #25 - Macro - "Match Vectors".
That is a bigger, more powerful macro than you need to perform just that specific task, but if you learn how, you can do it quickly and easily.
Here is a demonstration where the user form has been simplified to show only some of the controls:
Thank you very much, I have to check if it works in X5 :)
Zyzio said:Thank you very much, I have to check if it works in X5 :)
Sorry; that will only work in X7 or newer versions.
I understand, if the code is not protected with a password, I will try to modify it, maybe I can adapt to x5 :)