update Generic Master bas2
This commit is contained in:
@@ -62,6 +62,12 @@ Function ReadCSVAs2DArrayStrict( _
|
||||
Err.Raise 5003, , "CSV file is empty."
|
||||
End If
|
||||
|
||||
If lines.Count = 1 Then
|
||||
If hasHeader Then
|
||||
Err.Raise 5005, , "CSV file data is empty."
|
||||
End If
|
||||
End If
|
||||
|
||||
' === loop the row, validate column count ===
|
||||
Dim i As Long
|
||||
For i = 1 To lines.Count
|
||||
@@ -76,9 +82,16 @@ Function ReadCSVAs2DArrayStrict( _
|
||||
Next i
|
||||
|
||||
Dim result As Variant
|
||||
ReDim result(1 To lines.Count, 1 To expectedColumnCount)
|
||||
|
||||
For i = 1 To lines.Count
|
||||
Dim startRow As Long
|
||||
If hasHeader Then
|
||||
startRow = 2
|
||||
Else
|
||||
startRow = 1
|
||||
End If
|
||||
|
||||
ReDim result(startRow To lines.Count, 1 To expectedColumnCount)
|
||||
|
||||
For i = startRow To lines.Count
|
||||
rowArr = lines(i)
|
||||
Dim j As Long
|
||||
For j = LBound(rowArr) To UBound(rowArr)
|
||||
|
||||
Reference in New Issue
Block a user