Sub getmatrix(ByVal filepath As String, ByRef matrix() As String)
Dim s As String, temp() As String, temp1() As String, rows As Long, cols As Long, i As Long, j As Long
Open filepath For Binary As #1
s = Space(LOF(1))
Get #1, , s
Close #1
temp = Split(s, vbCrLf)
rows = UBound(temp)
cols = UBound(Split(temp(0), " "))
ReDim matrix(rows, cols)
For i = 0 To rows
temp1 = Split(temp(i), " ")
For j = 0 To cols
matrix(i, j) = temp1(j)
Next
Next
Erase temp1
Erase temp
End Sub
Private Sub Command1_Click()
Dim x() As String, i As Integer, j As Integer
getmatrix "c:\xxx.txt", x
For i = 0 To UBound(x, 1)
For j = 0 To UBound(x, 2)
Print x(i, j); " ";
Next
Print
Next
End Sub