Okay, this should get you started:
(defun c:FOO (/ ss)
(vl-load-com)
(if (setq ss (ssget "_x" '((0 . "INSERT") (2 . "WD_METR") (66 . 1))))
((lambda (i / e s od r v n d tag)
(while (setq e (ssname ss (setq i (1+ i))))
;; Extract object data
(setq b (ade_odgetfield e (setq od (car (ade_odgettables e))) "BARCODE" 0))
(setq s (strcase (ade_odgetfield e od "STATUS" 0)))
;; Populate attributes
(if (and (setq n (vla-get-effectivename
(setq v (vlax-ename->vla-object e))))
(setq d (vla-item (vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)))
n)))
(foreach attrib (vlax-invoke v 'getattributes)
(vlax-for item d
(if (= (vla-get-objectname item) "AcDbAttributeDefinition")
(if (= (vla-get-tagstring attrib)
(vla-get-tagstring item))
(cond
((= "BARCODE" (setq tag (vla-get-tagstring item)))
(vla-put-textstring attrib b))
((= "STATUS" tag)
(cond
((= "MANUAL" s)
(vla-put-textstring attrib "M"))
((= "RADIO" s)
(vla-put-textstring attrib "X"))
((vla-put-textstring attrib "?"))))))))))
[color=seagreen];; Write data to excel[/color]
))
-1))
(princ))
I revised your block a bit (hope you don't mind), so that instead of using Text at the center of the block, you now have an Attribute, which changes between "M" (Manual), "X" (Radio), and "?" (Others). I used the "Status" field for populating this attribute.
Next, I'm working on a segment of code which will insert the new block at the old block's location, and add the Object Data from the old to the new, then delete the old block. This should only be required to be run once per drawing.
Please start the "write to excel" part, so we can combine them.
WD_METR.dwg