Import

M

Minh Le

Hi all,

I would like to capture error files that are failed to import. Below is my
code
Dim myfile
Dim mypath
mypath = "C:\Documents and Settings\"
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

I need some code here to capture files that are failed.I don't know how to
write the code to check for error files.

if DoCmd.TransferSpreadsheet acImport, 8, "PR", mypath & myfile, True is
not imported, then
How do i check the line above for error file???

MsgBox "Transfer Failed: " & vbCrLf & "XLS: " & myfile&


End If
myfile = Dir

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