I am trying to get the total number of lines in a text file with the code below (The file is about 190,577kb) because i create a progress bar for when I am actually reading the lines with my program so the user knows how far along it is. Is there a better way to read the lines where I do not get this error or is there a better approach to size the incremental widths of my progress bar? Edit: filePathnew is the files that is 190,577kb
Code:
iFileNo = FreeFile
Open filePathNew For Binary As iFileNo
strFile = Space(LOF(iFileNo)) 'Set file buffer size
Get iFileNo, , strFile 'Load the text
Close iFileNo
'The array holds the file, one line per element
strArray = Split(strFile, vbNewLine)