I want 'Enter' to be a line break in a text-box

M

Michelle

I want to be able to type text into a multi-line text-box on a form,
and when I hit the Enter key, I want it to insert a line-break (hard
or soft) or paragraph break so that I can then type on the next line.

At the moment, when I press Enter, it moves to the next control on the
form.

(When I'm not in the text-box,I'm happy for Enter to just do what it
normally does.)

Is this possible?

M
 
C

Chip Pearson

Set the MultiLine property to True and set the EnterKeyBehavior
property to True. You can do this manually in the designer's
Properties window or with code when the form loads:

Private Sub UserForm_Initialize()
With Me.TextBox1
.MultiLine = True
.EnterKeyBehavior = True
End With
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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