WordWrap Property

See Also1EUQZN2                 Example760Z0VO>Low

Applies To



Determines whether a label with its AutoSize2ZZ9BBZ property set to True expands vertically or horizontally to fit the text specified in its CaptionF6ZZXB property.


[form.]label.WordWrap[ = { True|False} ]


The WordWrap property settings are:

Setting             Description


True                 The text wraps; the label expands or contracts vertically to fit the text and the size of the font.  The horizontal size does not change.

False                (Default) The text does not wrap; the label expands or contracts horizontally to fit the length of the text and vertically to fit the size of the font and the number of lines.



Use this property to determine how a label displays its contents.  For example, a graph that changes dynamically might have a label containing text that also changes.  To maintain a constant horizontal size for the label and allow for increasing or decreasing text, you would set the WordWrap and AutoSize properties to True.

If you want a label to expand only horizontally, set WordWrap to False.  If you do not want the label to change size, set AutoSize to False.


Note   If AutoSize is False, the text always wraps, regardless of the size of the label or the setting of the WordWrap property.  This may obscure some text, since the label does not expand in any direction.


Data Type

IntegerDOKXHY (Boolean)

See Also


AutoSize Property2ZZ9BBZ

Caption PropertyF6ZZXB


Programmer's Guide:

Chapter 3, "Creating and Using Controls"

WordWrap Property Example

The example puts text into two labels and uses the WordWrap property to illustrate their different behavior.  To try this example, paste the code into the Declarations section of a form that contains two labels.  Then press F5 and click the form to toggle the WordWrap property.

Sub Form_Load ()
  Dim Author1, Author2, Quote1, Quote2   ' Declare variables.
  Label1.AutoSize = True                 ' Set AutoSize.
  Label2.AutoSize = True
  Label1.WordWrap = True                 ' Set WordWrap.
  Quote1 = "I couldn't wait for success, so I went on without it."
  Author1 = "  - Jonathan Winters"
  Quote2 = "Logic is a system whereby one may go wrong with confidence."
  Author2 = "  - Charles Kettering"
  Label1.Caption = Quote1 & Chr(10) & Author1
  Label2.Caption = Quote2 & Chr(10) & Author2
End Sub

Sub Form_Click ()
  Label1.Width = 1440                    ' Set width to 1 inch in twips.
  Label2.Width = 1440
  Label1.WordWrap = Not Label1.WordWrap  ' Toggle WordWrap property.
  Label2.WordWrap = Not Label2.WordWrap
End Sub