hi all

i write this code and it work fine to split the text to equal part

put the problem is that ....

for example i need to see a msgbox with only max characters of "45" there no problem if it is less than 45 to see full last word

example text

The decision to bail out carmaker Chrysler was made by the narrowest of margins, President Obama's former "car czar" reveals.

now with this app i will see msg box with

The first msgbox = The decision to bail out carmaker Chrysler wa
The second one is = s made by the narrowest of margins, President
The third one is =Obama's former "car czar" reveals.


i need to see this ::

The first msgbox = The decision to bail out carmaker Chrysler
The second one is = was made by the narrowest of margins,
The third one is = President Obama's former "car czar" reveals.

i need to add a code to check the last character if it is "space" or not if not i need it to reduce value of aa until he found a "space" and show the split text.





Code:
Dim a As Integer
Dim b As Integer
Dim c As Integer 
Dim lf As Integer
Dim aa As Integer
Dim bb As Integer
Dim newa As String

aa = 45
bb = 1


a = Len(Text1.Text) / aa
b = a + 1
c = 0




For lf = 1 To b

newa = Mid$(Text1.Text, bb, aa)
bb = bb + aa
MsgBox newa
Next lf


End Sub
regards