Skip to main content Link Search Menu Expand Document (external link) Copy Copied

SplitField

Splits the specified field in the imported CSV data.


Syntax

expression.SplitField(aIndex, CharToSplitWith, [RowSplit])

Parameters

Part Description
aIndex Required. Identifier specifying a Long Type variable representing the index of the field to be splited.
CharToSplitWith Required. Identifier specifying a String Type variable. Represents the character to be used in the split operation.
RowSplit Optional. Identifier specifying a Boolean Type variable. Determines when the field is split into new columns or rows.

Returns value

Type: CSVinterface


See also
ImportFromCSV method, ImportFromCSVstring method.

Behavior

The SplitField method will split the field specified in the current instance, if all records have the same number of fields, using the character specified via CharToSplitWith.

☕Example

Sub SplitField()
    Dim CSVint As CSVinterface
    
    Set CSVint = New CSVinterface
    With CSVint.parseConfig
        .path = Environ("USERPROFILE") & "\Desktop\Demo_file.csv"
    End With
    With CSVint
        .ImportFromCSV .parseConfig
        On Error Resume Next
        .SplitField 1, "|", True											'Split field into new rows at index 1 using a pipe character.
    End With
    Set CSVint = Nothing
End Sub

Back to Methods overview