Split demonstration : CSV « File Path « VBA / Excel / Access / Word






Split demonstration

 
Sub UsefulStringFunctions() 
    Dim sTestWord As String 
    sTestWord = "One, Two, Three, 4, Five, Six" 
    DemoSplit sTestWord 
End Sub 
Sub DemoSplit(sCSV As String) 
    Dim vaValues As Variant 
    Dim nIndex As Integer 
    vaValues = Split(sCSV, ",") 
    For nIndex = 0 To UBound(vaValues) 
        Debug.Print "Item (" & nIndex & ") is " & vaValues(nIndex) 
    Next 
End Sub 

 








Related examples in the same category

1.Query text file
2.Saves the active worksheet in the workbook named MyWorkbook.xls as a comma-delimited text file named test.csv:
3.Brings up a dialog box that asks the user for a filename.
4.Create text file based database
5.Export active worksheet to CSV file