Return to line into a text box..

W

Warrio

Hello!
How is it possible to write a memo by code and make the text display into
many lines?
I've tried the following code into vba,
myTextBox = "Hello!!" & Chr(10) & Chr(13) & "my name is: Smith"

but the ASCI characters 10 and 13 are not recognized in a form and
therefore, the textbox contains:
Hello!!(square square)my name is: Smith

If there is any suggestion, it would be more than welcome!
Thanks
 
C

Cheryl Fischer

In order to get a CRLF, you need to reverse the order you are using, so that
Chr(13) is before Chr(10):

myTextBox = "Hello!!" & Chr(13) & Chr(10) & "my name is: Smith"

or

myTextBox = "Hello!!" & vbCRLF & "my name is: Smith"


hth,
 
S

SFAxess

Try this instead
myTextBox = "Hello!!" & vbCrLf & "my name is: Smith

----- Warrio wrote: ----

Hello
How is it possible to write a memo by code and make the text display int
many lines
I've tried the following code into vba
myTextBox = "Hello!!" & Chr(10) & Chr(13) & "my name is: Smith

but the ASCI characters 10 and 13 are not recognized in a form an
therefore, the textbox contains
Hello!!(square square)my name is: Smit

If there is any suggestion, it would be more than welcome
Thank
 

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