Display files that failed to import

M

Minh Le

I have tried to import mutilple excel files into MS Acess table. It works
fine. Sometimes, there is (are) some file(s) failed to import because of
error data in Excel. I would like to have some code to display file(s) that
failed. So i can open the failing file(s) to check what is wrong with it.

Dim myfile
Dim mypath
mypath = "C:\Documents and Settings\dle\Desktop\Tally_sheets\"
myfile = Dir(mypath & "*.xls")
While myfile <> ""
'this will import ALL the excel files (one at a time, but automatically)
in this folder. Make sure that's what you want.
DoCmd.TransferSpreadsheet acImport, 8, "PR", mypath & myfile, True

HERE, This line --->i would like to have some code to capture error files
that failed to import.
PLease help

myfile = Dir

MsgBox "it's done", vbOKOnly, "It's a test"

Wend
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top