Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>str = Replace(str, vbLf, "") </code></pre> <p>This code takes all the line break's out of the code</p> <p>if you just want the last one out:</p> <pre><code>If Right(str, 1) = vbLf Then str = Left(str, Len(str) - 1) </code></pre> <p>is the way how you tryed OK.</p> <hr> <p>Update:</p> <p><strong>line feed = ASCII 10</strong>, <strong>form feed = ASCII 12</strong> and <strong>carriage return = ASCII 13</strong>. Here we see clearly what we all know: the PC comes from the (electric) typewriter</p> <p><strong>vbLf</strong> is <strong>Chr (10)</strong> and means that the cursor jumps one line lower (typewriter: turn the roller) <strong>vbCr</strong> is <strong>Chr (13)</strong> means the cursor jumps to the beginning (typewriter: pull back the roll)</p> <p>In <strong>DOS</strong>, a line break is always <strong>VBCrLf or Chr (13) &amp; Chr (10)</strong>, in files anyway, but e.g. also with the text boxes in VB.<p> In an <strong>Excel cell</strong>, on the other hand, a line break is only <strong>VBLf</strong>, the second line then starts at the first position even without vbCr. <strong>With vbCrLf then go one cell deeper</strong>.</p> <p>So it depends on where you read and get your String from. if you want to remove all the vbLf (Char(10)) and vbCr (Char(13)) in your tring, you can do it like that: </p> <pre><code>strText = Replace(Replace(strText, Chr(10), ""), Chr(13), "") </code></pre> <p>If you only want t remove the Last one, you can test on do it like this:</p> <pre><code>If Right(str, 1) = vbLf or Right(str, 1) = vbCr Then str = Left(str, Len(str) - 1) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload