Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove final CR LF character from a word document

Status
Not open for further replies.

mcs1000

Programmer
Jul 3, 2007
26
GB
I need to remove all the carriage return characters from a text file(using vb6). I have used a word automation to open the file and replace all the CR characters.

When I save the word file the last character in the file is a CR character.

How can I get rid of this character?
 




You ought to ask this question in Forum222.

Check out the vbCr, vbLf and vbCrLf constants.

Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
You cannot remove the final paragraph mark - it is a placeholder for end of paragraph, end of section, end of document - in effect document information is 'held' in it.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
After removing what you can, can you put whats left into a variable and use the stringtofile command to store the file. That might result in a ctrl-Z as the end of file marker.
wjwjr

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
The problem is I need to send the file to a bank and it has to correspond to their specs to be parsed by their software.

Is there an easy way to automatically open a text file, delete the last char then save?
 
How large is this file? I have an old DOS-based text editor that can do this with a switch, but it cannot handle a really large document.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top