How can I read Line by Line, from a text file ?
----TEXTFILE---
C:\Windows
C:\Windows\System
C:\Windows\Start Menu
------END------
And I want to get line by line and place it in a variable ?!
How ?
Printable View
How can I read Line by Line, from a text file ?
----TEXTFILE---
C:\Windows
C:\Windows\System
C:\Windows\Start Menu
------END------
And I want to get line by line and place it in a variable ?!
How ?
Use Line Input statement:
JUST AN UPDATE IF YOU DON'T KNOW THE LENGTH OF THE FILE:Code:Dim FF As Integer: FF = FreeFile
Dim strLine1 As String
Dim strLine2 As String
Dim strLine3 As String
Open "C:\windows\desktop\myfile.txt" For Input As #FF
Line Input #FF, strLine1
Line Input #FF, strLine2
Line Input #FF, strLine3
Close #FF
[Edited by QWERTY on 07-18-2000 at 05:17 PM]Code:Dim FF As Integer: FF = FreeFile
Dim strLine() As String
Dim Index As Integer
ReDim Preserve strLine(Index)
Open "C:\windows\desktop\myfile.txt" For Input As #FF
Do While Not EOF(FF)
Line Input #FF, strLine(Index)
Index = Index + 1
ReDim Preserve strLine(Index)
Loop
Close #FF