Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Import - Stripping Question

Status
Not open for further replies.

Pilly170

IS-IT--Management
Aug 28, 2003
36
US
Hi,

Im trying to import a text file automatically into access, but I want to strip the top 3 lines of the text file.

eg. Heres the original text. 5 lines only.
<Start of File>
13;Company Name SOD ;Address 1
CAR041 BacklogOfOrders DATE: 01.10.2003

Branch DocumentCode DocumentNo CustNo
13 OA 708532 12871 Customer1
<End of File>

Any ideas how i strip off the top 3 lines using vba?

Thanks
 
When I had a similar need, the only solution I could come up with was using VBA code to read the file, skip the initial lines, and write the remainder to a new file, which I then linked as a text table.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
ok, how did you get it to skip the first few lines?
 
Something like this:
Code:
    Open &quot;MyFile.csv&quot; For Input As #1
    Open &quot;MyFile.txt&quot; For Output As #2
    Line Input #1, s
    Line Input #1, s
    Line Input #1, s
    Do While Not Eof(1)
        Line Input #1, s
        Print #2, s
    Loop
    Close #1
    Close #2

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top