With Application.Filesearch Error - Driving me nuts!!!!

rexel12

Board Regular
Joined
Feb 19, 2002
Messages
86
I'm attempting to use a 97 access database in access 2002 (access XP).

When I run the code below (which works fine in 97) the With Application.Filesearch text is highlighted in yellow and accompanied by the following error

"Run Time Error -2147467259 (80004005)
Method 'Filesearch' of object'_Application' failed"



Public Function Importfiles()
Dim strPath As String

With Application.FileSearch
.NewSearch
.fileName = "*.xls"
.SearchSubFolders = True
.LastModified = msoLastModifiedAnyTime
.LookIn = "s:\shared\returns"
.Execute

strPath = .FoundFiles(1)
End With

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "Table Name Here", strPath

End Function


I've inherited this database and I'm not that familiar with access.

Any ideas as to why this happens?

All help greatfully received.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
try removing:

acSpreadsheetTypeExcel8

as you have Excel 2002 it will be a different version, removing it will assume the default


DoCmd.TransferSpreadsheet acImport, , "Table Name Here", strPath




Ziggy
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,309
Members
451,696
Latest member
Senthil Murugan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top