473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Word Wrap Function / Wrapping Text

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
3 7030
On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "ch************@yahoo.com"
<ch************@yahoo.comwrote:

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

-Tom.
>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 11 '07 #2

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*************@cox.netwrote:
>On Mon, 10 Dec 2007 11:16:27 -0800 (PST), "ch************@yahoo.com"
<ch************@yahoo.comwrote:

Wouldn't wrap??? Just set the CanGrow property to True.
>>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
---
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: yawnmoth | last post by:
word wrapping normally treats some spaces as line feeds, if there hasn't been a line feed for quite a while. so while a string with eighty consecutive a's might not word wrap, a space placed...
5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
11
by: name | last post by:
Here is a first attempt at a line/word wrapping utility. Seems to work okay, but lacks some checking stuff, etc. --------------------------------------------------------- #include <stdio.h>...
10
by: Douglas G | last post by:
I've tried various ideas on this problem, but I don't see word wrapping. Can you point out what is wrong? It's a K&R exercise, and I'm still new to programming. Other pointers would be helpful...
10
by: Jeff B. | last post by:
Has anyone come across a decent algorithm for implementing word wrap features in .net printing? I have a small component that uses basic printing techniques (i.e. e.Graphics.DrawString in a...
3
by: ColinC | last post by:
Hi, as a newbie to Visual Studio C# Forms development, I'd like some advice on the following. I have a form with a tab control. I have some tab titles that are three words e.g "house &...
10
by: Lorenzo Thurman | last post by:
I have a table cell that I want to wrap text inside of. I've tried both hard and soft wrap, but Firefox refuses to obey. IE 6&7 handle the wrap just fine. Does anyone know how I can fix this?
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
5
by: zeroblade | last post by:
When I shorten shrink the width of my internet, window how do i make not the text of my website word wrap. The text is in a paragraph tag. Ex. This is the text in the sentence. If I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.