; testtbl ; OP: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-cell-text-string-different-from-string-displayed/td-p/13274277 (defun c:testtbl (/ replaceall replacestr) (defun replacestr (Obj new old / str) (foreach Property '(TextString TextOverride) (and (vlax-property-available-p Obj Property) (setq str (vlax-get Obj Property)) (while (vl-string-search old str) ;;<- look for string (alert (strcat "str original=" str " Property=" (vl-princ-to-string Property))) (setq str (vl-string-subst new old str )) ;;<-replace here (alert (strcat "str replaced=" str)) (vlax-put Obj Property str) ;(princ Obj) ;(setq Obj2 (vlax-vla-object->ename Obj)) ;(setq Obj2 (entget Obj2)) ;(setq Obj2 (subst (cons 1 new) (assoc 1 Obj2) Obj2)) ;(entupd Obj2) ) ) ) ) (defun replaceall (new old) (vlax-for n (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vlax-for m n (if (and (= "AcDbBlockReference" (vla-get-objectname m)) (= :vlax-true (vla-get-hasattributes m))) (progn (alert (strcat "Block=" (vla-get-objectname n) "with Attributes Objectname=" (vla-get-objectname m))) (foreach att (vlax-invoke m 'getattributes) (replacestr att new old) ) ) (progn (alert (strcat "Block=" (vla-get-objectname n) "with No Attributes Objectname=" (vla-get-objectname m))) (replacestr m new old) ) ) ) ) ) (replaceall "TESTING" "$CABLE") )