我相信我已经提出了一种非常有效的方法来逐行读取非常非常大的文件.如果您知道更好/更快的方式或者看到改进的空间,请告诉我.我正在努力改进编码,所以你提出的任何建议都会很好.希望这也是其他人可能会觉得有用的东西.
它看起来比我在测试中使用Line Input快8倍.
'This function reads a file into a string. '
'I found this in the book Programming Excel with VBA and .NET. '
Public Function QuickRead(FName As String) As String
Dim I As Integer
Dim res As String
Dim l As Long
I = FreeFile
l = FileLen(FName)
res = Space(l)
Open FName For Binary Access Read As #I
Get #I, , res
Close I
QuickRead = res
End Function
'This function works like the Line Input statement' …Run Code Online (Sandbox Code Playgroud)