No formattting preserved but an alternative approach:
Code:Sub M_snb() MsgBox F_snb_split("Today is a fine day to go outside because the weather is so nice.", 25) End Sub Function F_snb_split(c00, y) sn = split(Application.Trim(c00)) c00 = sn(0) For j = 1 To UBound(sn) If Len(c00 & sn(j)) + 1 > y Then sn(j - 1) = sn(j - 1) & vbLf c00 = sn(j) Else c00 = c00 & " " & sn(j) End If Next F_snb_split = Replace(Join(sn), vbLf & " ", vbLf) End Function




Reply With Quote

Bookmarks