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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write a file with only CHR 10 and not CHR 13

Status
Not open for further replies.

terzaghi

Programmer
Aug 25, 2003
49
IT
Hi,

I'm searching a method to write a text file that insert at the end of each line a Chr(10) (web standard) and not a (Chr(13) + Chr(10)) like "Print #" does.
I guess I have to write a binary file so I can insert whatever character I want.

Can anyone tell me what are the commands to do so?
I need something to substitute this code:

_________________________________
Open strPath For Output Shared As #mFileHandle

'Add text to the file
i = 1
While Sheet1.Cells(i, 1).Value <> ""
Print #mFileHandle, Sheet1.Cells(i, 1).Value
i = i + 1
Wend
_________________________________

Thanks a lot!
 
You could create/open a text file using the FileSystem object then use it's .write method and append Chr(10) wherever you need to.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
You may try this:
Print #mFileHandle, Sheet1.Cells(i, 1).Value & vbLf;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top