ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I want 'Enter' to be a line break in a text-box (https://www.excelbanter.com/excel-programming/420500-i-want-enter-line-break-text-box.html)

Michelle

I want 'Enter' to be a line break in a text-box
 
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

Chip Pearson

I want 'Enter' to be a line break in a text-box
 
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)


On Tue, 25 Nov 2008 06:12:49 -0800 (PST), Michelle
wrote:

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



All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com