Read a text file line by line
Purpose is to open up a text file and read the contents line by line.
Original Author: c23lemon
Inputs
None.
Assumptions
To modify for your use do the following:
1. Replace "folderName" and "fileName" to suit for your requirement.
2. Please make sure that when you define "folderName", that the backslash is included (Ex. C:Dump"
3. The variable "inputdata" will hold the current value of the line of text being read.
Note:
This code will only open the text file and read its contents line by line.
Returns
None.
Side Effects
None.
Code
Sub ReadLineByLine()
' Variable Declarations
Dim folderName As String
Dim fileName As String
folderName = "C:Dump"
fileName = "test.txt"
Open folderName & fileName For Input As #1
Do While Not EOF(1)
Line Input #1, inputdata
MsgBox inputdata
Loop
Close #1
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.