Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning chr(13) 1

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
1) If you hardcode the value of a text box in design view, you can force the value onto two lines. You just use ctrl + enter to force it. For example, ="a b" will display

a
b

*IF* you put a ctrl + enter between the two letters manually.


2) After some experimentation, I found that that key is chr(13).

3) I have a function that returns a text string. I want the text string to include a carriage return. This is the last line of my function...

makeHeader = myWeekday & "," & Chr(13) & myFullDate

That SHOULD work. Unfortunately it just puts a black line on the screen at the chr(13) position. :(

Please advise.

 
Many combinations to try:
makeHeader = myWeekday & "," & vbCr & myFullDate
makeHeader = myWeekday & "," & vbLf & myFullDate
makeHeader = myWeekday & "," & vbCrLf & myFullDate

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV
I tested your combinations. The only one that works is VbCrLF. So I tried:
..& chr(13) & chr(10)..
where chr(10) is line feed, and it also works.
So I guess when you manually do a control enter you are doing both a carriage return and line feed. Did not know that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top