Try this one:
;Tip1791: TXT2ATTDEF.LSP TEXT TO ATTRIBUTES (c)2002, Sanjay Kulkarni
(defun C:TXT2ATTDEF ()
(setq PCMDECHO (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq TXT1 (entget (car (entsel "\nSelect Text : "))))
(setq IFTXT (cdr (assoc 0 TXT1)))
(while (/= IFTXT "TEXT")
(setq
TXT1
(entget
(car
(entsel
(strcat
"\nSelection Error !! You selected "
IFTXT
"! \nPlease Select Text : "
) ;_ end of strcat
) ;_ end of entsel
) ;_ end of car
) ;_ end of entget
) ;_ end of setq
(setq IFTXT (cdr (assoc 0 TXT1)))
) ;_ end of while
(setq TXT1VAL (cdr (assoc 1 TXT1)))
(setq TXT1IP (cdr (assoc 10 TXT1)))
(setq TXT1HT (cdr (assoc 40 TXT1)))
(setq TXT1ROT (cdr (assoc 50 TXT1)))
(setq APRMPT (getstring T "\nAttribute prompt : "))
(entdel (cdar TXT1))
(setq PAFLAGS (getvar "AFLAGS"))
(setvar "AFLAGS" 0)
(command
"attdef"
""
TXT1VAL
APRMPT
TXT1VAL
TXT1IP
TXT1HT
(/ (* TXT1ROT 180) (/ 22.0 7.0))
) ;_ end of command
(setvar "AFLAGS" PAFLAGS)
;;(alert "\n\t(c) 2000 SanganakSakha \n\tSanganakSakha@ivillage.com")
(setvar "CMDECHO" PCMDECHO)
(princ)
)
;defun txt2attdef
;;(alert
;; "\t\t* AutoCAD 14 & AutoCAD 2000/2000i/2002 *\n\n\nThis routine converts the selected string to an attribute definition. \n\nTag and Default value of the new attribute are the same as the string being converted. \n\nThe new Attribute definition by default will be with ICVP value 'NNNN'. \n\nYou can change any/all attributes of this attdef subsequently using 'ddmodify' command. \n\n\nType 'txt2attdef' to execute.\n\n"
;;) ;_ end of alert
;;End Of Routine