|
-
June 13th, 2001, 01:48 PM
#1
Reading Line by line
I want to read Line by Line from a txt file useing the FileSystemObject. When i use .ReadLine
my string still contains all of what was in the txt file. Once i get one line i want to write it to another file and then go back the txt file to read a new line. Any Ideas??
[email protected]
-
June 13th, 2001, 01:49 PM
#2
-
June 13th, 2001, 01:52 PM
#3
Re: Reading Line by line
private Sub cmdReadFile_Click()
Dim InStream as TextStream
BodyText = App.Path & "\body.txt"
set InStream = FSys.OpenTextFile(BodyText, 1, false, false)
While InStream.AtEndOfStream = false
TLine = InStream.ReadAll
strBody = strBody & TLine & vbCrLf
Wend
' Text1.Text = strBody
set InStream = nothing
Dim AddressInStream as TextStream
AddressText = App.Path & "\email.txt"
set AddressInStream = FSys.OpenTextFile(AddressText, 1, false, false)
While AddressInStream.AtEndOfStream = false
TLine = AddressInStream.ReadLine
strAddress = strAddress & TLine & vbCrLf
Wend
Text1.Text = strAddress & strBody
set AddressInStream = nothing
End Sub
-
June 13th, 2001, 01:54 PM
#4
Re: Reading Line by line
email.txt
looks like this
[email protected]
[email protected]
with about 200 address.
-
June 13th, 2001, 02:03 PM
#5
Re: Reading Line by line
Every time you say this:
strAddress = strAddress & TLine & vbCrLf
It is appending the new stuff to the old stuff. You need to just use:
strAddress = TLine & vbCrLf
HTH,
Erica
-
June 13th, 2001, 02:11 PM
#6
Re: Reading Line by line
strAddress = TLine & vbCrLf
This only gives me the last line in the email.txt.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|