Yes, I have tried that in VBA Macro and it worked.
And with numbers in iLogic it also works now.
I have alse get rid of the error message. It was caused by last line before End sub.
So the working code is:
Sub main AddLeaderNote()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
' Set a reference to the drawing curve segment.
' This assumes that a drawing curve is selected.
Dim oDrawingCurveSegment As DrawingCurveSegment
oDrawingCurveSegment = oDrawDoc.SelectSet.Item(1)
' Set a reference to the drawing curve.
Dim oDrawingCurve As DrawingCurve
oDrawingCurve = oDrawingCurveSegment.Parent
' Get the mid point of the selected curve
' assuming that the selected curve is linear
Dim oMidPoint As Point2d
oMidPoint = oDrawingCurve.MidPoint
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
' Create a few leader points.
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 0.5, oMidPoint.Y - 0.5))
'Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5))
' Create an intent and add to the leader points collection.
' This is the geometry that the leader text will attach to.
Dim oGeometryIntent As GeometryIntent
oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve)
Call oLeaderPoints.Add(oGeometryIntent)
' Create text with simple string as input. Since this doesn't use
' any text overrides, it will default to the active text style.
Dim sText As String
sText = "Measure<Br/>here"
Dim oLeaderNote As LeaderNote
oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)
oLeaderNote.VerticalJustification = 25601
' Insert a node.
Dim oFirstNode As LeaderNode
oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1)
'Dim oSecondNode As LeaderNode
'oSecondNode = oFirstNode.ChildNodes.Item(1)
End Sub
Thank you very much for help.