If you were going activex, a quick bash ...
(defun c:DeleteEmptyText ( / count )
(StartUndo)
(setq count 0)
(vlax-for layout
(vlax-get
(vlax-get
(vlax-get-acad-object)
'ActiveDocument
)
'Layouts
)
(vlax-for object (vlax-get layout 'Block)
(if
(and
(wcmatch
(vlax-get object 'ObjectName)
"AcDbText,AcDbMText"
)
(wcmatch
(vlax-get object 'TextString)
", ,\\A1;"
)
)
;; here we do have to trap an error
;; unless we've unlocked all layers
;; prior to running the routine
(vl-catch-all-apply
'(lambda ( )
(vlax-invoke object 'Delete)
(setq count (1+ count))
)
)
)
)
)
(princ
(strcat
(itoa count)
" empty text entities erased."
)
)
(EndUndo)
(princ)
)
Untested but should work. To answer the inevitable "Why vlax versus vla?" question in advance, I found when doing objectdbx stuff way back that on average vlax calls executed faster than equivalent vla calls. How much I don't recall, but it was enough to make me use the former in code that does a lot of iteration through collections et al.