将多个Excel文件导入Access [英] Importing Multiple Excel Files Into Access

查看:521
本文介绍了将多个Excel文件导入Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每个月都会获得一个excel文件,我希望在月底将其转移到Access中。因此,到月底我有大约20-25个excel文件,我想使用按钮将它们导入Access。 excel文件中包含的数据类似,因此导入时不应存在格式问题。


我在论坛中搜索并找到mmccarthy的代码来导入excel文件。我尝试使用该代码,但它一直给我一个错误消息找不到文件

I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to import them into Access using a button. The data contained in the excel files is similar, so there should no formatting issues while importing.

I searched through the forums and found the code by mmccarthy for importing excel files. I tried using that code, but it keeps giving me a error message "No files found"

展开 | 选择 | Wrap | 行号

推荐答案

所以这些* .xls文件都位于桌面上名为test的文件夹中?
So all these *.xls files are sitting in a folder called test on your desktop?


尝试将通配符放在文件路径的最后一个子目录中:



path =" C:\Documents and Settings\KK \Desktop\Test \ *。*"
Try placing the wildcard symbol in your last subdirectory in your file path:


path = "C:\Documents and Settings\KK\Desktop\Test\*.*"


mmccarthy - 是的,我桌面上的所有这些.xls文件p在名为Test的文件夹中。我删除了MsgBox下面的Exit Sub行。这是正确的事吗?


puppydog - 我试过了,但仍然告诉我没有找到文件。当我点击Ok时,它告诉我运行时错误''9'':下标超出范围。当我点击调试时,它会把我带到代码中的这一行 - 对于intFile = 1到UBound(strFileList)


谢谢。
mmccarthy - Yes, all these .xls files on my desktop in a folder named Test. I had deleted the line Exit Sub below the MsgBox. Was that the correct thing to do ?

puppydog - I tried that, but still tells me No files found. When I then click on Ok, it tells me Run-time error ''9'': Subscript out of range. When I click on debug, it takes me to this line in the code - For intFile = 1 To UBound(strFileList)

Thanks.


这篇关于将多个Excel文件导入Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆