easy question (insert carriage return)

Results 1 to 2 of 2

Thread: easy question (insert carriage return)

  1. #1
    Join Date
    Dec 1969

    Default easy question (insert carriage return)

    read = read.txt<BR><BR>What kind of function do I use to insert a carriage return (vbCr) after every 62 characters?<BR><BR>andy

  2. #2
    Join Date
    Dec 1969

    Default No function...a loop...

    &nbsp;<BR>&#060;%<BR>istr = read.txt &#039; really? not read.text? unusual<BR>ostr = ""<BR><BR>Do while Len(istr &#062; 62 )<BR> ostr = ostr & Left(istr,62) & vbNewLine<BR> istr = Mid(istr,63)<BR>Loop<BR>ostr = ostr & istr & vbNewLine <BR>%&#062;<BR><BR>Whatever you do, do *NOT* just use vbCR! Virtually no Windows editors can handle files with just vbCR in them. vbLF, alone, will work in wordpad and visual studio and Word (but not in Notepad), but the safest thing is what I showed you.<BR><BR>Do note that this will chop lines in the middle of words. You have to get more sophisticated if you want to chop only on word boundaries. HINT: Look into the InStrRev function.<BR><BR>

Posting Permissions

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