This sort of Library Routine may suit you for ensuring that TEXT < or whatever > is selected :-
http://www.vbdesign.net/expresso/showthread.php?postid=10070#post10070;;; Arguments:
;;; msg : The prompt string.
;;; kwd : Initget keywords string.
;;; def : Value to return if response is <enter>.
;;; typelist : Stringlist of entity types allowed for selection. If nil select anything.
;;; selectflag : If true nentsel permitted , otherwise use entsel.
;;; lockflag : If true dont allow selection from locked layers.
;;;
;;; Note : Arguments may be set to nil
;;;
;;; Return output from (n)entsel, a key word, the default argument, or nil.
;;;
;; example1 : (kpsl_EntSel "Select Arc Object" nil nil (list "ARC" "CIRCLE") nil T)
;; ==> (<Entity name: 40bcd540> (-28175.1 154575.0 1250.0))
;; example2 : (kpsl_EntSel "Select Datum Line" nil nil (list "LINE") T T) ; line in block
;; ==> (<Entity name: 4022c680> (-21613.1 142392.0 0.0)
;; ((70.0 0.0 0.0) (0.0 70.0 0.0) (0.0 0.0 70.0) (-21611.9 142635.0 0.0))
;; (<Entity name: 4022c6b8>) )
(if (setq vnum
(kpsl_EntSel "Select TEXT Object" nil nil (list "TEXT") nil t)
)
(getnum (cdr (assoc 1 (entget (car vnum)))))
(alert "Oooops")
)