Skip to content

Commit 1ba4676

Browse files
committed
Update CSVinterface.cls
1 parent 7ce9d93 commit 1ba4676

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/CSVinterface.cls

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ CSVsubsetSplit_MissingCSVfile:
401401
End Function
402402
Public Sub DumpToArray(OutPutArray() As Variant, _
403403
Optional ByRef DataSource As ECPArrayList = Nothing)
404-
If P_SUCCESSFUL_IMPORT Then
404+
If DataSource Is Nothing Then
405+
Set DataSource = P_CSV_DATA
406+
End If
407+
If Not DataSource Is Nothing Then
405408
Dim UB1 As Long, ub2 As Long
406409
Dim Counter1 As Long, Counter2 As Long
407410

408-
If DataSource Is Nothing Then
409-
Set DataSource = P_CSV_DATA
410-
End If
411411
UB1 = DataSource.count - 1
412412
ReDim OutPutArray(0 To UB1, 0 To P_VECTORS_MAX_BOUND)
413413

@@ -421,13 +421,13 @@ Public Sub DumpToArray(OutPutArray() As Variant, _
421421
End Sub
422422
Public Sub DumpToJaggedArray(OutPutArray() As Variant, _
423423
Optional ByRef DataSource As ECPArrayList = Nothing)
424-
If P_SUCCESSFUL_IMPORT Then
424+
If DataSource Is Nothing Then
425+
Set DataSource = P_CSV_DATA
426+
End If
427+
If Not DataSource Is Nothing Then
425428
Dim UB1 As Long
426429
Dim Counter1 As Long
427430

428-
If DataSource Is Nothing Then
429-
Set DataSource = P_CSV_DATA
430-
End If
431431
UB1 = DataSource.count - 1
432432
ReDim OutPutArray(0 To UB1)
433433

@@ -441,18 +441,19 @@ Public Sub DumpToSheet(Optional WBookName As String, _
441441
Optional rngName As String = "A1", _
442442
Optional ByRef DataSource As ECPArrayList = Nothing)
443443
On Error Resume Next
444-
If P_SUCCESSFUL_IMPORT Then
444+
Dim colNumber As Long
445+
446+
If DataSource Is Nothing Then
447+
Set DataSource = P_CSV_DATA
448+
colNumber = P_VECTORS_MAX_BOUND
449+
Else
450+
colNumber = UBound(DataSource(0))
451+
End If
452+
If Not DataSource Is Nothing Then
445453
Dim WBook As Workbook
446454
Dim outputSheet As Worksheet
447455
Dim OutputRange As Range
448-
Dim colNumber As Long
449456

450-
If DataSource Is Nothing Then
451-
Set DataSource = P_CSV_DATA
452-
colNumber = P_VECTORS_MAX_BOUND
453-
Else
454-
colNumber = UBound(DataSource(0))
455-
End If
456457
EnableOptimization
457458
'@------------------------------------------------------
458459
'Set the target Workbook
@@ -3148,4 +3149,5 @@ Private Function UnixToStandardEscapeSeq(ByRef UnixEscapedString As String, _
31483149
Else
31493150
UnixToStandardEscapeSeq = UnixEscapedString
31503151
End If
3151-
End Function
3152+
End Function
3153+

0 commit comments

Comments
 (0)