Hi,
First of all, if the title is not clear please feel free to propose a better title and I will change it.
I've got a txt document (which is a kind of csv document). For example data-students.txt and each line has 67 comma's so it has 68 fields.
I'm only interested in the following field nr's:
field 66, 67, 68, 7, 8, 9 which are the ID, Name, address, postalcode, city, countrycode
So I'd like to save these 6 fields(columns) in the order I mentioned above in a seperate student-list.txt file also delimeter seperated.
The first line of data-students.txt can be skipped since it holds different names.
I'm not even sure if the only way is to use an array or maybe it can be done without. My brain hurts when I think to much about it :-)
Note: would it make a difference to the script to do the same when the data-students.txt are seperated with semi-comma's and also when it would be saved with semi-comma's.
Thanks in advance.
This is what I got so far but maybe you have a better idea/way:
Sub makenewcsvlist()
Dim csvFilename As String
Dim actWorkbook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
csvFilename = "data-students.txt"
Workbooks.OpenText Filename:=csvFilename, DataType:=xlDelimited, Semicolon:=True, Local:=True
actWorkbook = ActiveWorkbook
'skip first row
'select fields 66,67,67,7,8,9 till last row
'copy to new workbook
'save new workbook as student-list.txt (also semicomma as delimeter)
actWorkbook.Close
Application.ScreenUpdating = True
End Sub
Greets
Bookmarks