jeudi 2 avril 2015

VBA that takes character delimited text file with headers and loop through each line and place it in a data dictionary collection?

I would like to construct a VBA code that can take a special character delimited text file that has headers. These headers are not always in the same place each time the text file is created. I would like the VBA code to loop through the text file until end, and place each line into a data dictionary collection with each "column" delimited to be put into appropriate data dictionary collection, Applicant.


Sometimes there are consecutive delimiters and I want this to be treated as one delimiter as well. So the headers below contain Name, College, Birthday, State. I don't want the extra delimiter before Birthday. But noting that the headers and the extra delimiter can move around.



Name | College | | Birthday | State
Annie | Kentucky | | 1986-12-01| NY
Bob | Missouri | | 1985-03-11| MA


etc


I want the VBA to have a data dictionary collection that can have the above data for example and each line, place into the dictionary collection with keys. For example, I want the keys to be composed of elements of the headers such as state and birthday.


Aucun commentaire:

Enregistrer un commentaire