Here is a similar routine that could be used as a template to create routines that change text height style or whatever
Peter Jamtgaard
Code:
(defun C:CHW (/ inCount sngTextWidth ssSelections objSelection)
(princ "\nSelect text entities to modify text width: ")
(setq ssSelections (ssget (list (cons 0 "TEXT,ATTDEF")))
sngTextWidth (getdist "\nEnter text width: ")
)
(if (and ssSelections
(> sngTextWidth 0.0)
)
(repeat (setq intCount (sslength ssSelections))
(setq intCount (1- intCount)
objSelection (vlax-ename->vla-object
(ssname ssSelections intCount)
)
)
(vla-put-scalefactor objSelection sngTextWidth)
)
)
(prin1)
)