Output to a Vertical Text File

mattmlm

New member
Local time
Today, 16:01
Joined
Jan 5, 2005
Messages
7
I found the below code searching through the forum and it almost does what I want but not quite!

The code writes to a file then outputs to a pop up box from an OnClick event on a form.

In the box the Chr(13) ensures that a carriage return is at the end of each line so the output it how I want it. Sadly when I open up the outputted text file there are no carriage returns in the text only the square character: ٱ

Any ideas as to how to get round this would be greately appreciated.

I can open it in word and wordpad and it does look right but I really could do with it as raw text in notepad!

Thanks in advance.


PHP:
Private Sub Command0_Click()
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, s
Set fs = CreateObject("Scripting.FileSystemObject")
fname = "c:\" & [PName] & ".txt"
fs.CreateTextFile fname 'fname 'Create a file
Set f = fs.GetFile(fname)
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Write "Address of person:" & Chr(13)
ts.Write [PName] & "this person lives at" & [Address] & Chr(13)
ts.Write "End of out put"
ts.Close
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
s = ts.ReadLine
MsgBox s
ts.Close

End Sub
 
You need CR and linefeed at the end of each line
 
Bravo!

Exactly what I wanted :o

Many thanks!
 

Users who are viewing this thread

Back
Top Bottom