PC Review


Reply
Thread Tools Rate Thread

Carriage Return and Line Feed

 
 
Francis Ang
Guest
Posts: n/a
 
      1st Apr 2009
I am trying to remove the 'carriage return' or 'line feed' from a text file.
I tried using the RIGHT and MID commands but it is not working.

I have searched the community website for examples but could not find any.

Could someone please help me out.

Thank you.
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      1st Apr 2009
Replace(strData,vbLF,"") for linefeed
Replace(strData,vbCrLF,"") for CRLF

If this post helps click Yes
---------------
Jacob Skaria


"Francis Ang" wrote:

> I am trying to remove the 'carriage return' or 'line feed' from a text file.
> I tried using the RIGHT and MID commands but it is not working.
>
> I have searched the community website for examples but could not find any.
>
> Could someone please help me out.
>
> Thank you.

 
Reply With Quote
 
RyGuy
Guest
Posts: n/a
 
      1st Apr 2009
You can try a few things...

Delete All Hard Returns:
Sub Remove_CR_LF()
With Selection
..Replace What:=Chr(39), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(146) & Chr(10), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(180), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End With
End Sub

Sub Remove_CR_LF()
With Selection
..Replace What:=Chr(160), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(13) & Chr(10), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(10), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End With
End Sub


I think those are ASCII Chr(13); yo may have other things in there too...
Backup your data before running any macros, just in case the results are
unintended...

HTH,
Ryan---



"Francis Ang" wrote:

> I am trying to remove the 'carriage return' or 'line feed' from a text file.
> I tried using the RIGHT and MID commands but it is not working.
>
> I have searched the community website for examples but could not find any.
>
> Could someone please help me out.
>
> Thank you.

 
Reply With Quote
 
Francis Ang
Guest
Posts: n/a
 
      1st Apr 2009
Thank you Jacob and RyGuy. Your suggestions work like a charm. Thank you
again.

"Jacob Skaria" wrote:

> Replace(strData,vbLF,"") for linefeed
> Replace(strData,vbCrLF,"") for CRLF
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Francis Ang" wrote:
>
> > I am trying to remove the 'carriage return' or 'line feed' from a text file.
> > I tried using the RIGHT and MID commands but it is not working.
> >
> > I have searched the community website for examples but could not find any.
> >
> > Could someone please help me out.
> >
> > Thank you.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line Feed & Carriage Return with XML? =?Utf-8?B?UmFlZCBTYXdhbGhh?= Microsoft ASP .NET 2 25th Oct 2004 03:07 PM
Re: Carriage Return and Line Feed Rick Brandt Microsoft Access 0 24th Aug 2004 04:09 PM
Carriage Return Line Feed Centaur Microsoft Access Forms 4 26th Jul 2004 09:42 PM
Carriage Return or Line Feed Fred Microsoft Access Reports 1 29th Sep 2003 11:46 PM
Carriage Return and Line Feed David N. Microsoft C# .NET 3 19th Aug 2003 09:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:21 AM.