Results 1 to 10 of 10

How to put CR/LF into a string?

Threaded View

  1. #1
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    How to put CR/LF into a string?

    Hi!

    Consider you have 3 strings
    Dim firstLine As String
    Dim secondLine As String
    Dim both As String
    then you like to do something like this

    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
    Last edited by keymuu; 11-20-2012 at 08:39 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1