Line break in textboxs

  • Thread starter Angela 'Angel' Brown
  • Start date
A

Angela 'Angel' Brown

I'm trying to create a line break in a text box and it wont work. I can get
it to work in a message box just not a text box

any suggestions?

code -
text box:
txtbox.Value = txtbox.Value + (Chr(13)) + StrMessage
message box:
MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
 
D

David Cleave

Hi Angela

For some bizarre reason unknown to sane people, you have to use chr(13) with
chr(10). I can't remember which way round, but obviously you can find that
out pretty easily.

Cheers

David
 
K

Klatuu

Chr(13) & Chr(10) have been around since the beginning of time. It is the
code for Carriage Return (Chr(13)) and Line Feed (Chr(10)). Back in the days
of Noah, it was a printer control signal to move the print head all the way
to the left and andvance the paper one line.
There are two equivilants in VBA you can use:
vrCrLf or vbNewLine

txtbox.Value = txtbox.Value & vbNewLine & StrMessage

Also note the change from the + to the &
In VBA, + is really a math operator and & is for concatenating strings.
 
A

Angela 'Angel' Brown

Thanks - worked a treat

Klatuu said:
Chr(13) & Chr(10) have been around since the beginning of time. It is the
code for Carriage Return (Chr(13)) and Line Feed (Chr(10)). Back in the days
of Noah, it was a printer control signal to move the print head all the way
to the left and andvance the paper one line.
There are two equivilants in VBA you can use:
vrCrLf or vbNewLine

txtbox.Value = txtbox.Value & vbNewLine & StrMessage

Also note the change from the + to the &
In VBA, + is really a math operator and & is for concatenating strings.
 
Top