Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.TransferSpreadsheet Error Trapping

Status
Not open for further replies.

jameshall

Technical User
Jul 9, 2002
36
GB
Hi All.

I am using DoCmd.TransferSpreadsheet to import some data from Excel. This is a weekly task and is completed by different people. Every so often the workbook gets renamed and this confuses my TransferSpreadSheet command

Is there away to read or update the names of worksheets in my Spreadsheet before I import the data?

Hopefully this will resolve the changed worksheet names.

Thanks In Advance

James

 
Hi James.

You could try using FileSearch:

With Application.Filesearch
.LookIn = your Folder
.Filename = your Filename
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) = 0 Then
[blue] For Each ff in .FoundFiles
...
Next [/blue]
End If
End With

By putting a recognition criteria in the for loop marked blue, you could locate the correct file...

Greetings,
Andy

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top