HI,
I have found the code below to import multiple .csv files into one table but I now need to append the file name to each file once its been imported so I can keep a track, if this is possible and as I'm very new to all this could you insert the code into the one below, so I cant make any mistakes, myfolder is called "originals" and located on my C:\ and it contains 5 .csv file called 1, 2, 3, 4 , 5
I also need to drop the headers after the first file is imported..
many thanks in advance
Sub Import_multiple_csv_files()
Const strPath As String = "C:\Addresspoint" 'Directory Path
Dim strFile As String 'Filename
Dim strFileList() As String 'File Array
Dim intFile As Integer 'File Number
'Loop through the folder & build file list
strFile = Dir(strPath & "*.csv")
While strFile <> ""
'add files to the list
intFile = intFile + 1
ReDim Preserve strFileList(1 To intFile)
strFileList(intFile) = strFile
strFile = Dir()
Wend
'see if any files were found
If intFile = 0 Then
MsgBox "No files found"
Exit Sub
End If
'cycle through the list of files & import to Access
'creating a new table called MyTable
For intFile = 1 To UBound(strFileList)
DoCmd.TransferText acImportDelimi, , _
"PETA VSK Merged", strPath & strFileList(intFile)
'Check out the TransferSpreadsheet options in the Access
'Visual Basic Help file for a full description & list of
'optional settings
Next
MsgBox UBound(strFileList) & " Files were Imported"
End Sub