Размеры для рамочки

Версия программы: 
17.3.0.772

Проблема вот в чем. Требуется макрос, который проставляет метки по углам выделенной области на расстоянии 5 мм, метки (уголки) 5 мм. После этого он должен проставить размеры по вертикали и горизонтали внутренней части метки и внешней части метки (флексоформа). В программировании я слаб. Методом записи макроса удалось дойти до этапа проставления меток, здесь все ок. Но проблема с размерами. Они стандартным инструментом проставляются в кореле и привязываются к конкретным координатам в рабочей области. Т.е. если запускаем макрос на новом месте размеры будут на старом, хотя привязаны к объекту. А нужно чтобы размеры стояли по краям выделенной области с уголками.

Sub corner5()
' Recorded 28.01.2015
Dim OrigSelection As ShapeRange
Set OrigSelection = ActiveSelectionRange
Dim s1 As Shape
Set s1 = ActiveLayer.CreateRectangle(2.097531, 6.143268, 2.251441, 6.10078)
s1.Rectangle.CornerType = cdrCornerTypeRound
s1.Rectangle.RelativeCornerScaling = True
s1.Fill.UniformColor.CMYKAssign 0, 0, 0, 0
s1.Outline.SetNoOutline
ActiveDocument.ReferencePoint = cdrCenter
s1.SetSize 0.19685, 0.01378
s1.Style.StringAssign "{""fill"":{""type"":""1"",""primaryColor"":""REGCOLOR,USER,100,00000000-0000-0000-0000-000000000000""},""outline"":{""type"":""0"",""overprint"":""0"",""angle"":""0"",""screenSpec"":""0,0,45000000,60,0"",""behindFill"":""0"",""scaleWithObject"":""0"",""overlapArrow"":""0"",""shareArrow"":""0"",""endCaps"":""0"",""joinType"":""0"",""width"":""0"",""aspect"":""100"",""matrix"":""1,0,0,0,1,0"",""color"":""CMYK255,USER,0,0,0,255,100,cccd19cb-4675-4a5e-8bda-d0bbbaab8af0"",""dashDotSpec"":""0"",""leftArrow"":""|0"",""leftArrowAttributes"":""0|0|0|0|0|0|0"",""rightArrow"":""|0"",""rightArrowAttributes"":""0|0|0|0|0|0|0"",""widelineWidth"":""5000"",""miterLimit"":""5"",""justification"":""0""},""transparency"":{}}"
Dim s2 As Shape
Set s2 = s1.Duplicate
s2.Rotate -90#
ActiveDocument.CreateShapeRangeFromArray(s1, s2).AlignAndDistribute 0, 1, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(s1, s2).AlignAndDistribute 2, 0, 0, 0, False, 2
Dim s3 As Shape
Set s3 = s2.Weld(s1, True, True)
s1.Delete
s2.Delete
Dim s4 As Shape
Set s4 = s3.Duplicate
ActiveDocument.ReferencePoint = cdrMiddleRight
s4.Stretch -1#, 1#
s4.OrderToFront
Dim dup1 As ShapeRange
Set dup1 = ActiveDocument.CreateShapeRangeFromArray(s3, s4).Duplicate
ActiveDocument.ReferencePoint = cdrBottomMiddle
dup1.Stretch 1#, -1#
dup1.OrderToFront
Dim eff1 As Effect
Set eff1 = OrigSelection(1).CreateContour(0, 0.19685, 1, 0, CreateCMYKColor(0, 0, 0, 100), CreateCMYKColor(0, 0, 0, 100), CreateCMYKColor(0, 0, 0, 100), 0, 0, 2, 4, 15#)
eff1.Contour.Direction = 1
eff1.Contour.OutlineColor = CreateRGBColor(255, 255, 255)
eff1.Contour.FillColor = CreateRGBColor(255, 255, 255)
ActiveDocument.CreateSelection eff1.Contour.ContourGroup, OrigSelection
ActiveSelection.Separate
' Recording of this command is not supported: SplitDualSpotObject
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), s3).AlignAndDistribute 0, 1, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), s3).AlignAndDistribute 2, 0, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), s4).AlignAndDistribute 0, 1, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), s4).AlignAndDistribute 1, 0, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), dup1(1)).AlignAndDistribute 0, 2, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), dup1(1)).AlignAndDistribute 2, 0, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), dup1(2)).AlignAndDistribute 0, 2, 0, 0, False, 2
ActiveDocument.CreateShapeRangeFromArray(ActiveLayer.Shapes(6), dup1(2)).AlignAndDistribute 1, 0, 0, 0, False, 2
OrigSelection.Delete
ActiveLayer.Shapes(5).Delete
End Sub