what is the purpose of vbcrlf
Printable View
what is the purpose of vbcrlf
It is a predefined constant you can use. It is more convenient to use than Chr$(13) & Chr$(10) - CR = 13, LF = 10. However, vbNewLine is a slightly faster alternative (for an unknown reason). vbCrLf can be considered more readable in other situations (it tells what characters are being added) while vbNewLine may be better in others (it tells that a line changes). In the end you can just use whichever one you find more convenient.
It's a VBA's constant that adds Carriage Return + Line Feed to some string.
You may also use vbNewLine wich is cross platform constant.
It can be quite useful when you want to display a multi-lined messagebox. :)
All is fun and games til you try that code and it doesn't work and you wonder why? Then you figure out that you have to turn the Multiline property to true and not false. Hahaha.
vbCrLf is also a command that must follow most Modem AT Commands.
AS FAR AS I KNOW...IT IS USE FOR MAKING A NEWLINE..LIKE & VbCrlf & and so on..
Interestingly, this command dates back to the Teletype Machine.
Bit of trivia -
CR = Carriage Return .... returns the carriage (think typewriters or teletypes) back to the beginning of the line... does not advance to the next line... which is why there is the...
LF = Line Feed ... advances the paper one line.... but does not return the carriage to the beginning of the line... which is why...
We have CRLF today... the two commands together return the carriage to the start position and then advance the paper one line.
-tg