Import text file

J

jsqrd

I'm having difficulty creating a routine to import a text file.

Specifically, my problem is associated with the first 8 lines (header
and other garbled junk) in a CSV text file which are not recognizable
via a standard import specification. My current workaround is to
remove the 8 lines in a text editor before importing the file via an
import specification, however I desire to programatically do perfrom
this task.

Any ideas?
 
D

Douglas J. Steele

One way would be to use VBA's file handling capabilities to read the file in
and write it out without the first 8 lines.

Another way would be import the data manually: again using VBA's file
handling capabilities, read the file in line by line, use the Split function
to break it into the individual fields and either add the data to an open
recordset or use INSERT INTO SQL.
 
G

Guest

This sounds exactly like an issue I had recently. See my posts and John
Nurick's replies dating 1/22/07 through 1/26/07 in the Importing and
Exporting discussion group (search for JJEWELL).
 
J

jsqrd

This sounds exactly like an issue I had recently. See my posts and John
Nurick's replies dating 1/22/07 through 1/26/07 in the Importing and
Exporting discussion group (search for JJEWELL).


Thanks for the reply - logic looks what I'm looking for...
Cut and pasted the code from Nurick's link and made corrections,
however I cannot seem to get the code to run (step mode or via run
button). Probably overlooking the obvious.

Any ideas?
 
G

Guest

As you can tell from the string of posts, I had trouble making the code work
as well, although it sounds like your issue and mine are different. I can't
think of anything to tell you to try. You might try replying to John's last
post under my question and see if he can provide any assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top