|
▼りった さん:
あ〜あ・・・
せっかく書いたんでUPしときます。
ジャグ配列って配列の配列の事です。Variantを利用します。
Collectionに入れても同じことです。
Sub t()
Dim x() As String
Dim y() As Variant
Dim bytBuf() As Byte
Dim fNum As Long
Dim fLen As Long
Dim sBuf As String, sBuf2() As String
Dim i As Long, j As Long
Dim iMax As Long
Const sPath As String = "E:\Data\01HOKKAI.CSV"
fLen = FileLen(sPath)
ReDim bytBuf(fLen)
fNum = FreeFile()
Open sPath For Binary As #fNum
Get #fNum, , bytBuf
Close #fNum
sBuf = StrConv(bytBuf, vbUnicode)
sBuf2 = Split(sBuf, vbCrLf)
iMax = UBound(sBuf2)
ReDim y(iMax)
For i = 0 To iMax - 1
x = Split(sBuf2(i), ",")
y(i) = x '配列に配列を格納する
Next i
'20番目のレコードを出力してみる
iMax = UBound(y(1))
For i = 0 To iMax - 1
Debug.Print y(20)(i)
Next i
End Sub
|
|