Const conFile As String = "C:\SomeExcelFiles\" 'Use your real path name
Dim strFilePath As String
Dim FileName As String
strFileName = Dir(conFile & "*.xls") 'you can use whatever name filter
you want
Do While Len(strFileName) > 0
strFilePath = conFile & strFileName
docmd.TransferSpreadsheet acImport, ,"TableName", _
strFilePath, False,"H14:N14"
strFileName = Dir()
Loop
--
Dave Hargis, Microsoft Access MVP
Dir is a reserved word, so you shouldn't use it. For a comprehensive list of
names to avoid, see what Allen Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
<losdosp...@gmail.com> wrote in message
news:e6a6d7d2-590b-4345...@a70g2000hsh.googlegroups.com...
No, was trying to get a list of xls files in the folder.
Const conFile As String = "C:\SomeExcelFiles\" 'Use your real path
name
Dim strFilePath As String
Dim strFileName As String '<---- Added the "str" prefix. now it
should compile and work.