Hi guys!
I am working on an application where a text file is opened then some lines are deleted based on a criteria.
I am using the following code to read the text per line:
Supposedly I would get 58 for the Debug.Print row_number since 58 is the number of lines on the text file, but instead I get 1.
But when I try Debug.Print LineFromFile, the whole file gets printed..
Do you guys have an idea why I am getting 1 only for the number of lines?
Thanks a lot!
I am working on an application where a text file is opened then some lines are deleted based on a criteria.
I am using the following code to read the text per line:
Code:
If FileName(root_loc, period, wsc_code) = "" Then
MsgBox "There is no e-file found for the period M" & period & "."
Else
'Opens the e-file
Open FileName(root_loc, period, wsc_code) For Input As #1
row_number = 0
Do Until EOF(1)
'reads the text line per line until the end of file
Line Input #1, LineFromFile
row_number = row_number + 1
Loop
Close #1
Debug.Print row_number
End If
Supposedly I would get 58 for the Debug.Print row_number since 58 is the number of lines on the text file, but instead I get 1.
But when I try Debug.Print LineFromFile, the whole file gets printed..
Do you guys have an idea why I am getting 1 only for the number of lines?
Thanks a lot!