Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    vbCr vs. vbCrLf (VBA Excel)

    Sub T()
    MsgBox "Hello" & vbCr & Application.UserName
    MsgBox "Hello" & vbCrLf & Application.UserName
    End Sub

    vbCrLf, Chr(13) + Chr(10), Carriage return
    Regards,
    Rudi

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: vbCr vs. vbCrLf (VBA Excel)

    Cr and Lf are really "legacy" terms, derived from the way mechanical typewriters work - you could either return the carriage without feeding the paper (Cr), feed the paper without moving the carriage (Lf) or do both (CrLf), which is the usual requirement when moving onto the next line of typing. Early printers used the same controls and applications followed suit. As time progressed, the real implications of exactly what kind of Cr/Lf combinations did what became rather blurred. In console-based C programs, they still work like the originals, but for many things it's anyone's guess until you try them out.

    In VB, sometimes either/ any will work as CrLf, other times you'll see differences. The reason for the "Sq" and "SqSq" tooltip renderings is because the first is a single character, not displayable in the tooltip, while the latter is two characters.

    Alan

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: vbCr vs. vbCrLf (VBA Excel)

    Thx for that clear answer Alan. Question answered!
    Cheers
    Regards,
    Rudi

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: vbCr vs. vbCrLf (VBA Excel)

    CR and LF are "format effectors", as are, e.g., FF and VT.

    CR just moves to the beginning of the current line.
    LF moves to te next line.

  5. #5
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: vbCr vs. vbCrLf (VBA Excel)

    Tx Howard, appreciate the input!
    Regards,
    Rudi

Posting Permissions

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