No, its a bit more than that....
Code:
Public Sub ImportAllFilesInDir(ByVal pvDir)
Dim vFil, vTargT
Dim i As Integer
dim sSql As String
Dim db 'As Database
Dim fso
Dim oFolder, oFile
On Error GoTo errImp
If Right(pvDir, 1) <> "\" Then pvDir = pvDir & "\"
sTbl = "xlFile"
Set db = CurrentDb
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(pvDir)
For Each oFile In oFolder.Files
vFil = pvDir & oFile.Name
If InStr(sfile, ".xls") > 0 Then 'ONLY DO EXCEL FILES
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="US Food Product Prices Newest", FileName:=vFil , HasFieldNames:=True, Range:="default"
endif
Next
Set db = Nothing
Set fso = Nothing
Set oFile = Nothing
Set oFolder = Nothing
DoCmd.SetWarnings True
Exit Sub
errImp:
MsgBox Err.Description, vbCritical, "ImportAllFilesInDir():" & Err
End Sub