A
Adrian T
Hello,
I have an input in sequential format (semicolon delimited). Each record or
line is seperated by a carriage return and in the actual model, I could have
thousands of lines representing economic scenarios. My goal is to find out
the total number of lines before running any of calculations. Currently, my
code looks like this:
Dim strInputFileName As String
Dim strDataLine As String
Dim intFileNum As Integer
strInputFileName = <path>
intFileNum = FreeFile
Open strInputFileName For Input As intFileNum
While Not EOF(intFileNum)
Line Input #intFileNum, strDataLine
intScenario = intScenario + 1
Wend
Since my input/data is very very big, this process takes sometimes before I
get my total number of lines/scenarios (intScenario).
Do you know any better solution to find out how many lines/records/scenarios
in the file faster without using the while loop? I only care with the number
of lines, not the length of each line.
The closest function that's I could find from the help file is
LOF(intFileNum). But this looks like the number of characters in the file and
not the number of lines.
Please help and thanks very much,
Adrian T
I have an input in sequential format (semicolon delimited). Each record or
line is seperated by a carriage return and in the actual model, I could have
thousands of lines representing economic scenarios. My goal is to find out
the total number of lines before running any of calculations. Currently, my
code looks like this:
Dim strInputFileName As String
Dim strDataLine As String
Dim intFileNum As Integer
strInputFileName = <path>
intFileNum = FreeFile
Open strInputFileName For Input As intFileNum
While Not EOF(intFileNum)
Line Input #intFileNum, strDataLine
intScenario = intScenario + 1
Wend
Since my input/data is very very big, this process takes sometimes before I
get my total number of lines/scenarios (intScenario).
Do you know any better solution to find out how many lines/records/scenarios
in the file faster without using the while loop? I only care with the number
of lines, not the length of each line.
The closest function that's I could find from the help file is
LOF(intFileNum). But this looks like the number of characters in the file and
not the number of lines.
Please help and thanks very much,
Adrian T