Author Topic: Carriage return needed  (Read 4207 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Swamp Rat
  • Posts: 502
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: 7526
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 11 x64 - AutoCAD /C3D 2023

Custom Build PC

cmwade77

  • Swamp Rat
  • Posts: 1443
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: 12
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.