Author Topic: Carriage return needed  (Read 1831 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Bull Frog
  • Posts: 458
Carriage return needed
« on: November 19, 2015, 02:12:29 PM »
Is it possible to add a carriage return in the middle of this line of code so that the
resulting display would show:
2. LASER: xxx
3. AREA: xxx

rather than 2. LASER: xxx 3. AREA: xxx

Code: [Select]
INPUTDATA = "2. LASER: " & LaserInchs1 & " " & "3. AREA: " & oFace1

VBA is so foreign to me...any help would be appreciated...Thanks

ronjonp

  • Needs a day job
  • Posts: 7027
Re: Carriage return needed
« Reply #1 on: November 19, 2015, 02:14:12 PM »
Maybe use vbcrlf ?
Quote
INPUTDATA = "2. LASER: " & LaserInchs1 & vbcrlf & "3. AREA: " & oFace1

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

cmwade77

  • Swamp Rat
  • Posts: 1206
Re: Carriage return needed
« Reply #2 on: November 23, 2015, 01:14:59 PM »
Another options is chr(13)
Code: [Select]
INPUTDATA = "2. LASER: " & LaserInchs1 & CHR(13) & " " & "3. AREA: " & oFace1

mmelone

  • Mosquito
  • Posts: 11
Re: Carriage return needed
« Reply #3 on: November 23, 2015, 04:14:34 PM »
vbCr - Carriage Return
vbLf - Line Feed
vbCrLf - Carriage Return and Line Feed
vbNewLine - Same as vbCrLf
CHR$(10) - Line Feed
CHR$(13) - Carriage Return

In Windows environments, a new line is denoted by the two consecutive characters Carriage Return (vbCr, or CHR$(13), or \r) and Line Feed (vbLf, or CHR$(10), or \n).  When you read text files written from Windows, you will generally find that a new line is denoted by that character combination.

In *nix environments, a new line is denoted only by only the Line Feed character.

This is of particular importance when importing text files into databases.