Split text by a number of characters

Many ways to skin a … Here’s one idea I came up with that works for my needs. But I’m always open to new ideas.

In Action block for a button.

Dim TheWords(-1) As string
theWords = TextArea1.text.Split(" “) // text area field burst into an array of words.
dim t1, t2 as integer
dim i, tmpstring as string
t1=0
t2=0
for each i in theWords
t1=t1+1
t2=i.totext.length + t2
if t2 < 80 then
tmpstring=tmpstring + " " + i
else
msgbox(tmpstring)
tmpstring=”"
t2=0
end if

next