bhoffste
New Member
- Joined
- Apr 22, 2003
- Messages
- 26
This question could go in Access or Excel, but since I'm working in Access, I've plopped it here...
I am creating an automated process to import a bunch of text files into Access. I want to avoid creating a separate "Spec" for each file (there are over 180 files) and instead want to code my own dynamic importing rules. So far it's been going fine, except for one item...
I can't figure out a reliable way to determine in VBA whether a given text file is comma-delimited, tab-delimited, etc. Obviously there is nothing inherent in the file's properties, at least as far as I know. Sometimes the extension is the ticket (e.g. "csv" usually means comma-delimited), but that's not always reliable, since "txt" could mean a million things. The only thing I can think of is to open the file via IO and come up with some logic (e.g. if each line contains a certain number of commas, then assume the file is comma-delimited), but that too sounds like a half-baked method.
I am hoping that I'm just missing something incredibly obvious and can benefit from the great minds in this forum. Thanks in advance for any ideas.
- Ben
I am creating an automated process to import a bunch of text files into Access. I want to avoid creating a separate "Spec" for each file (there are over 180 files) and instead want to code my own dynamic importing rules. So far it's been going fine, except for one item...
I can't figure out a reliable way to determine in VBA whether a given text file is comma-delimited, tab-delimited, etc. Obviously there is nothing inherent in the file's properties, at least as far as I know. Sometimes the extension is the ticket (e.g. "csv" usually means comma-delimited), but that's not always reliable, since "txt" could mean a million things. The only thing I can think of is to open the file via IO and come up with some logic (e.g. if each line contains a certain number of commas, then assume the file is comma-delimited), but that too sounds like a half-baked method.
I am hoping that I'm just missing something incredibly obvious and can benefit from the great minds in this forum. Thanks in advance for any ideas.
- Ben