function wraptext(ttw as string, xs as integer) f_r as string for a = 1 to len(ttw) if mid$(ttw,a) = " " sep = a endif if text width(left$(ttw, a)) > xs if sep = 0 f_r = f_r + left$(ttw, a)+chr$(13)+chr$(10) ttw = right$(ttw, len(ttw)-a) else f_r = f_r + left$(ttw, sep)+chr$(13)+chr$(10) ttw = right$(ttw, len(ttw)-sep) endif a = 0 sep = 0 endif next a if f_r = "" f_r = ttw else f_r = f_r + ttw endif endfunction f_r