WordWrap in textbox

J

Jason Morin

Hello all. I have a textbox (named txtdef) on a userform.
When the userform gets activated, txtdef gets populated
with a cell value that contains a big group of words. I'm
struggling with forcing the cell contents to wrap within
the text box so the entire definition is visible. Snip of
my code that doesnt' work:

Private Sub UserForm_Activate()

With txtdef
.Value = Cells(rndrow, 1).Offset(, 2)
.WordWrap = True
End With

End Sub

The text box ends up looking like:

***********************
*This is a test of usi*
* *
* *
***********************

instead of:

***********************
*This is a test of *
*using the text box *
*wrap properly. *
***********************

Thanks.
Jason
 
C

Chip Pearson

Jason,

Set the MultiLine property to True. E.g.,

Me.TextBox1.WordWrap = True
Me.TextBox1.MultiLine = True
Me.TextBox1.Text = "this is an example of some long text " & _
"that should wrap in the text box."



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
B

Bob Phillips

Hi Jason,

Make sure that the WordWrap and Multiline properties for the textbox are
both set to True.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
G

Guest

Hi there

I am by far no expert; however, I ran into the same problem. I needed to make sure the textbox size on the userform was first large enough to hold the data and them in the property box made multiple lines equal true

Hopes this help

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top