Function read_file(fileName As String, array2() As String)
Dim fileContents As String
Dim stream As Object
Set stream = CreateObject("ADODB.Stream")
stream.Type = 2
stream.Charset = "UTF-8"
stream.Open
stream.LoadFromFile fileName
fileContents = stream.ReadText
stream.Close
Set stream = Nothing
array2() = Split(fileContents, Chr(10))
End Function
用这种方式读入后,根据Chr(10)来对其进行拆分,放入数组,其结果每行存入数组中