Connecting Tech Pros Worldwide Forums | Help | Site Map

Word Wrap Function / Wrapping Text

christianlott1@yahoo.com
Guest
 
Posts: n/a
#1: Dec 10 '07
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
Tom van Stiphout
Guest
 
Posts: n/a
#2: Dec 11 '07

re: Word Wrap Function / Wrapping Text


On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "christianlott1@yahoo.com"
<christianlott1@yahoo.comwrote:

Wouldn't wrap??? Just set the CanGrow property to True.

-Tom.


Quote:
>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
Chuck Grimsby
Guest
 
Posts: n/a
#3: Dec 13 '07

re: Word Wrap Function / Wrapping Text



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
<no.spam.tom7744@cox.netwrote:
Quote:
>On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "christianlott1@yahoo.com"
><christianlott1@yahoo.comwrote:
>
>Wouldn't wrap??? Just set the CanGrow property to True.
Quote:
Quote:
>>I needed this for address labels that wouldn't wrap. Couldn't find the
>>function so I made one. Splits at space.
Quote:
Quote:
>>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
---
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
christianlott1@yahoo.com
Guest
 
Posts: n/a
#4: Dec 13 '07

re: Word Wrap Function / Wrapping Text


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 :(
Closed Thread