L
Lucas_london
Hi,
I need to automate the importing of three CSV files (along with feild names
located in first row) in a folder into serperate tables in Access. Hoevever
the number of feilds in each file will vary/change with each import so I need
access to be able to determine the number of columns to import. I know this
is easy to do manually but I am now looking for a automated VBA solution as I
need to do this several times a week.
The names of the three files are:
1) BOE.csv (23 Cols)
2) Indices.csv (29 Cols)
3)Technicals.csv (21 cols )
The first row in each file contains the fields/columns headings. I do not
want to assign any primary keys. I have found the code below to import files
from a given folder. Could this be adopted in anyway to do what I need?
Thanks
Lucas
Dim strFile As String
Dim strFolder As String
strFolder = "C:\MyFolder\MySubfolder\" ' the final slash is important!
strFile = Dir$(strFolder & "*.txt")
Do While Len(strFile) > 0
strFile = Dir$()
Loop
I need to automate the importing of three CSV files (along with feild names
located in first row) in a folder into serperate tables in Access. Hoevever
the number of feilds in each file will vary/change with each import so I need
access to be able to determine the number of columns to import. I know this
is easy to do manually but I am now looking for a automated VBA solution as I
need to do this several times a week.
The names of the three files are:
1) BOE.csv (23 Cols)
2) Indices.csv (29 Cols)
3)Technicals.csv (21 cols )
The first row in each file contains the fields/columns headings. I do not
want to assign any primary keys. I have found the code below to import files
from a given folder. Could this be adopted in anyway to do what I need?
Thanks
Lucas
Dim strFile As String
Dim strFolder As String
strFolder = "C:\MyFolder\MySubfolder\" ' the final slash is important!
strFile = Dir$(strFolder & "*.txt")
Do While Len(strFile) > 0
strFile = Dir$()
Loop