Hey everyone,
I have a text file that I'm bringing into VBA with the FileSystemObject method.. I want to read the data that is in the .txt file into an array. In the text file there are 5470 lines and 20 columns.. putting a "watch" on my "arr" variable, I basically want the first row to be 20 categories, and then every row thereafter to be sorted into those 20 categories.. This is my code this far.
Sub readtextfile()
Dim oFSO As New FileSystemObject
Dim oFS
Dim arr(0 To 5469) As Variant
Dim i As Integer
i = 0
Set oFS = oFSO.OpenTextFile("C:\documents and settings\jaspeh\desktop\allmunis.txt")
Do Until oFS.AtEndOfStream
sText = oFS.ReadLine
sText = Split(sText, vbTab)
arr(i) = sText
i = i + 1
Loop
End Sub
I have also attached an image of my "watch" - Ideally I would like the values of arr(0)(0) through arr (0)(20) to be the expressions themselves, and then every one of the 20 categories in arr(1) through arr(5470) to fall into their respective categories..
Arr.PNG
Bookmarks