Please try:
;; TEXT SUM TO FIELD
;;
(defun c:Fsum (/ lst pt ss)
(vl-load-com)
(prompt "\nSelect text to add numbers.")
(if (setq ss (ssget '((0 . "TEXT,MTEXT"))))
(progn
(setq pt (vlax-3D-Point (getpoint "\n Select Point: ")))
(setq lst
(strcat
"%<\\AcExpr \("
(vl-string-right-trim
"+"
(apply 'strcat
(mapcar
'(lambda (x)
(strcat
"%<\\AcObjProp Object(%<\\_ObjId "
(itoa x)
">%).TextString>% +"
)
)
(mapcar
'vla-get-objectid
(mapcar
'vlax-ename->vla-object
(vl-remove-if
'listp
(mapcar 'cadr (ssnamex ss))
)
)
)
)
)
)
"\)>%"
)
)
(vla-addMText
(if (zerop
(vla-get-activespace
(setq Activ_doc
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
)
(vla-get-paperspace Activ_doc)
(vla-get-modelspace Activ_doc)
)
pt
0.0
lst
)
)
)
(princ)
)
;;
;;WIZ_12JAN10