; tbsr search & replace all cell text values on selected tables ; modified from: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-replace-blank-table-cell-values/td-p/10715608 ; OP: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/table-cell-text-string-different-from-string-displayed/td-p/13274277 (defun c:tbsr ( / doc found sel tbd valuefind valuereplace) (setq valuefind "$CABLE" valuereplace "TESTING" ) (vl-load-com) (defun tbd ( obj / col row txt ) (repeat (setq row (vla-get-rows obj)) (repeat (setq row (1- row) col (vla-get-columns obj)) (setq txt (vla-gettext obj row (setq col (1- col)))) (if (wcmatch txt (strcat "*" valuefind "*")) (progn (setq txt (vl-string-subst valuereplace valuefind txt)) (vla-settext obj row col txt) (setq found (1+ found)) ) ) ) ) (princ) ) (if (setq sel (ssget "_:L" '((0 . "ACAD_TABLE")))) ; select unlocked table objects (progn (setq found 0 doc (vla-get-activedocument (vlax-get-acad-object)) ) (vla-startundomark doc) (princ(strcat"\nSelected " (itoa (setq count (sslength sel))) " AutoCAD Tables...")) (repeat (sslength sel) ; cycle through all selected tables (tbd (vlax-ename->vla-object (ssname sel (setq count (1- count))))) ) (vla-endundomark doc) (princ(strcat"\nFound " (itoa found) " " valuefind " to Replace with " valuereplace ".")) ) (princ"\nNO AutoCAD Tables Found") ) (princ) )