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)
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
> 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
[quoted text clipped - 6 lines]
> message box:
> MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
Klatuu - 03 Aug 2005 17:05 GMT
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.
> Hi Angela
>
[quoted text clipped - 16 lines]
> > message box:
> > MsgBox (txtbox.Value + (Chr(13)) + StrMessage)
Angela 'Angel' Brown - 04 Aug 2005 09:04 GMT
Thanks - worked a treat
> 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
[quoted text clipped - 28 lines]
> > > message box:
> > > MsgBox (txtbox.Value + (Chr(13)) + StrMessage)