VBA: Shape.Dimension.Precision = 1 not working

Hello,

I am writing a macro creating linear dimensions for shapes.

Everything works apart from changing default precision from 2 to 0.

Help gives this example:

Sub Test()
Dim shp1 As Shape, shp2 As Shape
Set shp1 = ActiveLayer.CreateRectangle2(0, 0, 5, 2.5)
Set shp2 = ActiveLayer.CreateLinearDimension(cdrDimensionHorizontal, shp1.SnapPoints(1), shp1.SnapPoints(3))
shp2.Dimension.Linear.Style = cdrDimensionStyleDecimal
shp2.Dimension.Precision = 3
End Sub

It does not work, I get this (i.e. default precision of 2 decimal places):

What am I doing wrong? I would be grateful for any help.

Parents
No Data
Reply
  • I faced the same problem with CorelDRAW X8 and wrote the following work-around:

    Public Sub ForceDimensionPrecision(ByVal s As Shape, ByVal precision As Integer)
        s.Style.GetProperty("dimension").SetProperty "precision", precision
    End Sub

    Hope this will be helpful to others.

Children