ASCII - "First Row Contains Field Names"

G

Guest

Albert D. Kallal (Access MVP) and I discussed a Syware Visual CE ASCII
File yesterday. I tried using an Import Spec & Checked the "First Row
Contains Field Names", but it failed.

However, removing the First Row (containing Field Names) from the file &
using the Import Spec into an existing Table worked...using TransferText.

So...other than opening each .csv file in Excel (& deleting the First Row),
is there a way to do that w/ VBA?

TIA - Bob
 
S

Smartin

Bob said:
Albert D. Kallal (Access MVP) and I discussed a Syware Visual CE ASCII
File yesterday. I tried using an Import Spec & Checked the "First Row
Contains Field Names", but it failed.

However, removing the First Row (containing Field Names) from the file &
using the Import Spec into an existing Table worked...using TransferText.

So...other than opening each .csv file in Excel (& deleting the First Row),
is there a way to do that w/ VBA?

TIA - Bob

Maybe this (probably buggy) air code will give you a start:

dim FileHandleIn as integer
dim FileHandleOut as integer
dim SomeText as string
FileHandleIn = freefile()
Open "[path to source file]" for input as #FileHandleIn
FileHandleOut = freefile()
Open "[path to dest file]" for output as #FileHandleOut
Line Input #FileHandleIn, SomeText ' discard first row
do while not eof(FileHandleIn)
Line Input #FileHandleIn, SomeText
Write #FileHandleOut, SomeText
loop
close #FileHandleIn
close #FileHandleOut

HTH
 
G

Guest

Will give it a try, & report back.

Thank you - Bob

Smartin said:
Bob said:
Albert D. Kallal (Access MVP) and I discussed a Syware Visual CE ASCII
File yesterday. I tried using an Import Spec & Checked the "First Row
Contains Field Names", but it failed.

However, removing the First Row (containing Field Names) from the file &
using the Import Spec into an existing Table worked...using TransferText.

So...other than opening each .csv file in Excel (& deleting the First Row),
is there a way to do that w/ VBA?

TIA - Bob

Maybe this (probably buggy) air code will give you a start:

dim FileHandleIn as integer
dim FileHandleOut as integer
dim SomeText as string
FileHandleIn = freefile()
Open "[path to source file]" for input as #FileHandleIn
FileHandleOut = freefile()
Open "[path to dest file]" for output as #FileHandleOut
Line Input #FileHandleIn, SomeText ' discard first row
do while not eof(FileHandleIn)
Line Input #FileHandleIn, SomeText
Write #FileHandleOut, SomeText
loop
close #FileHandleIn
close #FileHandleOut

HTH
 
G

Guest

Works BEAUTIFUL...

THANK you - Bob

Smartin said:
Bob said:
Albert D. Kallal (Access MVP) and I discussed a Syware Visual CE ASCII
File yesterday. I tried using an Import Spec & Checked the "First Row
Contains Field Names", but it failed.

However, removing the First Row (containing Field Names) from the file &
using the Import Spec into an existing Table worked...using TransferText.

So...other than opening each .csv file in Excel (& deleting the First Row),
is there a way to do that w/ VBA?

TIA - Bob

Maybe this (probably buggy) air code will give you a start:

dim FileHandleIn as integer
dim FileHandleOut as integer
dim SomeText as string
FileHandleIn = freefile()
Open "[path to source file]" for input as #FileHandleIn
FileHandleOut = freefile()
Open "[path to dest file]" for output as #FileHandleOut
Line Input #FileHandleIn, SomeText ' discard first row
do while not eof(FileHandleIn)
Line Input #FileHandleIn, SomeText
Write #FileHandleOut, SomeText
loop
close #FileHandleIn
close #FileHandleOut

HTH
 
S

Smartin

Bob said:
Works BEAUTIFUL...

THANK you - Bob

Smartin said:
Bob said:
Albert D. Kallal (Access MVP) and I discussed a Syware Visual CE ASCII
File yesterday. I tried using an Import Spec & Checked the "First Row
Contains Field Names", but it failed.

However, removing the First Row (containing Field Names) from the file &
using the Import Spec into an existing Table worked...using TransferText.

So...other than opening each .csv file in Excel (& deleting the First Row),
is there a way to do that w/ VBA?

TIA - Bob
Maybe this (probably buggy) air code will give you a start:

dim FileHandleIn as integer
dim FileHandleOut as integer
dim SomeText as string
FileHandleIn = freefile()
Open "[path to source file]" for input as #FileHandleIn
FileHandleOut = freefile()
Open "[path to dest file]" for output as #FileHandleOut
Line Input #FileHandleIn, SomeText ' discard first row
do while not eof(FileHandleIn)
Line Input #FileHandleIn, SomeText
Write #FileHandleOut, SomeText
loop
close #FileHandleIn
close #FileHandleOut

HTH

Awesome. Glad to know!
 

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