Message 1 of 6

Not applicable
10-22-2019
09:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following code (mostly stolen from a post here, somewhere), and it works, mostly.
The source data has line breaks, and no comma at the end of the line, so the last item on row 1 and the first item on row 2 (and so on) are NOT split.
Any ideas?
oFolder = "C:\Metadata Files" oFile = oFolder & "\" & "00_Source.csv" oRead = System.IO.File.OpenText(oFile) 'read the file oRead = System.IO.File.OpenText(oFile) EntireFile = oRead.ReadToEnd() oRead.Close() 'create aray from text info 'splitting at that comma oSplit = Split(EntireFile, ",") oSplitcol = 1 oSplitRow = 1 i = 0 For Each wrd In oSplit MessageBox.Show("Index " & vbCrLf _ & "Row: " & oSplitRow & ", Col: " & oSplitcol & " = " & oSplit(i)) oSplitcol += 1 i += 1 If oSplitcol > oSplitColTotal Then oSplitRow += 1 oSplitcol = 1 End If Next
Solved! Go to Solution.