Hello Dszlapka, welcome in the forum!
I am in vacation right now, I can't test it, but the "strcat" method should work.
(defun c:KT_dlugosc ( / poly att)
(while
(and
(setq poly (ssget "_+.:S:E" '((0 . "*LINE"))))
(setq att (car (nentsel "\nSelect Attribute")))
(eq "AcDbAttribute"
(vla-get-objectname (setq att (vlax-ename->vla-object att)))
)
)
(vlax-put att
'TextString
(strcat (rtos (vlax-curve-getDistAtParam
(setq poly (ssname poly 0))
(vlax-curve-getEndParam poly)
)
2 0
) "m")
)
)(princ)
)
Please try this code and post a feed-back. Post the error message you get, for sure someone will be able to fix it!