Return to line into a text box..

  • Thread starter Thread starter Warrio
  • Start date Start date
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
 
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,
 
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
 
Back
Top