I'd like to import a CSV file with VBA.
Is there a way to do this on-the-fly? I recorded the "Text Import Wizard" and it's a good start, but I'm getting lost on how to assign scan the header row (1st row) prior to assignment of the data type.
- Some of the columns should be formatted as text (i.e., numbers with leading or trailing zeros such as ZIP codes), others as numbers, some as dates, and others should be skipped.
- I know the proper data type by looking at the header row name, however, the order of the columns is not always the same upon import -- so it's not as easy as saying, column 1 = text, column 2 = number, etc... because they will come in differently.
Is there a way to do this on-the-fly? I recorded the "Text Import Wizard" and it's a good start, but I'm getting lost on how to assign scan the header row (1st row) prior to assignment of the data type.