By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 446,282 Members | 1,713 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,282 IT Pros & Developers. It's quick & easy.

Word Wrap Function / Wrapping Text

 P: n/a I needed this for address labels that wouldn't wrap. Couldn't find the function so I made one. Splits at space. Function cvtWordWrap(Apl As String, Leng As Long) As String Dim i As Long If Len(Apl) Leng Then i = 0 Top: If i = Leng Then cvtWordWrap = Apl: Exit Function If Mid(Apl, Leng - i, 1) = " " Then cvtWordWrap = Mid(Apl, 1, Leng - i) & Chr(13) & Chr(10) & Mid(Apl, Leng - i + 1) Else i = i + 1 GoTo Top End If Else cvtWordWrap = Apl End If End Function Dec 10 '07 #1
Share this Question
3 Replies

 P: n/a On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "ch************@yahoo.com" I needed this for address labels that wouldn't wrap. Couldn't find thefunction so I made one. Splits at space. Function cvtWordWrap(Apl As String, Leng As Long) As StringDim i As LongIf Len(Apl) Leng Theni = 0Top:If i = Leng Then cvtWordWrap = Apl: Exit Function If Mid(Apl, Leng - i, 1) = " " Then cvtWordWrap = Mid(Apl, 1, Leng - i) & Chr(13) & Chr(10) & Mid(Apl,Leng - i + 1) Else i = i + 1 GoTo Top End IfElsecvtWordWrap = AplEnd IfEnd Function Dec 11 '07 #2

 P: n/a Can Grow?!? On Labels?!? Ahh.... That might not be such a good idea, since that may cause the textbox to grow beyond the label size. On Mon, 10 Dec 2007 19:12:12 -0700, Tom van Stiphout On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "ch************@yahoo.com">I needed this for address labels that wouldn't wrap. Couldn't find thefunction so I made one. Splits at space. >>Function cvtWordWrap(Apl As String, Leng As Long) As StringDim i As LongIf Len(Apl) Leng Theni = 0Top:If i = Leng Then cvtWordWrap = Apl: Exit Function If Mid(Apl, Leng - i, 1) = " " Then cvtWordWrap = Mid(Apl, 1, Leng - i) & Chr(13) & Chr(10) & Mid(Apl,Leng - i + 1) Else i = i + 1 GoTo Top End IfElsecvtWordWrap = AplEnd IfEnd Function --- Please Post Any Replies To This Message Back To the Newsgroup. There are "Lurkers" around who can benefit by our exchange! Dec 13 '07 #3

 P: n/a The CanGrow property was not working for me. It was a textbox and has the CanGrow property set. It does not fall to the next line down, it continues off the side of the page :( Dec 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.