Join the club
OK Try this, I've changed the lisp slightly. I have an upgraded version, if this works, that contains error and undo grouping.
I've tested on your test drawing although I've renamed the "TESTER-TITLEBLOCK" to "TITLEBLOCK" to fit the in with the lisp. This works in my test.
(defun c:bpv ( / ss obj atts flg)
(prompt "\nSelect a Titleblock to be replaced : ")
(setq ss (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))
obj (vlax-ename->vla-object (ssname ss 0))
atts (vlax-invoke obj 'getattributes)
);end_setq
(foreach att atts
(if (= (strcase (vlax-get-property att 'tagstring)) "DIMENSION") (setq t_val (vlax-get-property att 'textstring)))
);end_foreach
(vla-delete obj)
(setq ss nil)
(command "-purge" "_A" "*" "_N")
(command "-insert" "TITLEBLOCK.DWG" "9,0" "" "" "")
(while (not flg)
(command "explode" "last")
(setq ss (ssget "_X" '((0 . "INSERT") (2 . "TBLOCK-NEW"))))
(cond ( (and ss (= (sslength ss) 1))
(setq obj (vlax-ename->vla-object (ssname ss 0))
atts (vlax-invoke obj 'getattributes)
);end_setq
(foreach att atts
(if (= (strcase (vlax-get-property att 'tagstring)) "DIMENSION") (vlax-put-property att 'textstring t_val))
);end_foreach
(setq flg t ss nil)
)
);end_cond
);end_while
(princ)
);end_defun
(vl-load-com)
;end