Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50103

How to put CR/LF into a string?

$
0
0
Hi!

Consider you have 3 strings
Code:

Dim firstLine As String
Dim secondLine As String
Dim both As String

then you like to do something like this

Code:

firstLine = "abc - this would be the first line"
secondLine = "def - and this would be se second line"
both = firstLine & Chr(13) & secondLine

and then you would like to paste it to Notepad so there would be two lines.
Chr(13) does not work, neither does vbCRLf work...

What should be instead of Chr(13), so when you paste both to Notepad there
would then be two lines? Like this:
abc - this would be the first line
def - and this would be se second line

as the attachment TwoLines.txt

regards
keymuu

Viewing all articles
Browse latest Browse all 50103

Trending Articles