Question : convert delimited text file into 2 dimension array

I'm stuck. I have a file that is tab delimited like:
Tom     Smith
John    Doe
I'm reading the file in vba into an array with split like:
   
    '  Let VB generate the file channel number
    lFileNum = FreeFile
    '  Reads the whole file into memory all at once
    Open stTextTestFileName For Binary As #lFileNum
      stTextFile = Space(LOF(lFileNum))
      Get #lFileNum, , stTextFile
    Close #lFileNum
'put into array
    stRecords = Split(stTextFile, vbCrLf)
'here's where I'm stuck, how can I either directly read the file into a 2d array or convert the 1d array created by Split into a 2d array like
arr(0,0)=Tom
arr(0,1)=Smith
arr(1,0)=John
arr(1,1)=Doe

thanks for looking and your comments
alan

Answer : convert delimited text file into 2 dimension array

From your last line...

    Dim NewArr() As String
    ReDim NewArr(0 To UBound(stRecords), 0 To 1) As String
    For Counter = LBound(stRecords) To UBound(stRecords)
        TestArr = Split(stRecords(Counter), vbTab, 1)
        NewArr(Counter, 0) = TestArr(0)
        If UBound(TestArr) > 0 Then NewArr(Counter, 1) = TestArr(1)
    Next


That leaves your 2-d array as NewArr.
Random Solutions  
 
programming4us programming4us