BMLekki
June 14th, 2001, 10:48 AM
I need to read one line of a txt and then store it to a string. Then take that string and use it to build a different file. Once that is finished it needs to go back and read line two.
Any ideas?
This is what I'm working with.
Dim FSys as new FileSystemObject
Dim strAddress as string
Dim strSubject as string
Dim strBody as string
private Sub Form_Load()
Call ReadFiles
End Sub
private Sub genEmail()
Dim OutStream as TextStream
outEmail = App.Path & "\outEmail.txt"
set OutStream = FSys.CreateTextFile(outEmail, true, false)
OutStream.WriteLine "..h1 " & strAddress
OutStream.WriteLine "..h2 " & strSubject
OutStream.WriteLine "..h3 " & strBody
OutStream.WriteLine "..h4 SEND"
set OutStream = nothing
End
End Sub
private Sub ReadFiles()
Dim InStream as TextStream
BodyText = App.Path & "\body.txt"
set InStream = FSys.OpenTextFile(BodyText, 1, false, false)
While InStream.AtEndOfStream = false
TLine = InStream.ReadLine
strSubject = strSubject & TLine & vbCrLf
TLine = InStream.ReadAll
strBody = strBody & TLine & vbCrLf
Wend
' Text1.Text = strBody
set InStream = nothing
Call GetAddress
End Sub
private Sub GetAddress()
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
strAddress = TLine & vbCrLf
Wend
'Text1.Text = strAddress & strBody
'Text1.Text = strAddress & strBody
set AddressInStream = nothing
Call genEmail
End Sub
Any ideas?
This is what I'm working with.
Dim FSys as new FileSystemObject
Dim strAddress as string
Dim strSubject as string
Dim strBody as string
private Sub Form_Load()
Call ReadFiles
End Sub
private Sub genEmail()
Dim OutStream as TextStream
outEmail = App.Path & "\outEmail.txt"
set OutStream = FSys.CreateTextFile(outEmail, true, false)
OutStream.WriteLine "..h1 " & strAddress
OutStream.WriteLine "..h2 " & strSubject
OutStream.WriteLine "..h3 " & strBody
OutStream.WriteLine "..h4 SEND"
set OutStream = nothing
End
End Sub
private Sub ReadFiles()
Dim InStream as TextStream
BodyText = App.Path & "\body.txt"
set InStream = FSys.OpenTextFile(BodyText, 1, false, false)
While InStream.AtEndOfStream = false
TLine = InStream.ReadLine
strSubject = strSubject & TLine & vbCrLf
TLine = InStream.ReadAll
strBody = strBody & TLine & vbCrLf
Wend
' Text1.Text = strBody
set InStream = nothing
Call GetAddress
End Sub
private Sub GetAddress()
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
strAddress = TLine & vbCrLf
Wend
'Text1.Text = strAddress & strBody
'Text1.Text = strAddress & strBody
set AddressInStream = nothing
Call genEmail
End Sub