简体   繁体   English

导入Excel以使用通配符进行访问

[英]Importing excel to access with wildcards

I am trying to import an excel document to a table that doesn't yet exist in access 我正在尝试将Excel文档导入到Access中尚不存在的表中

I am using the following code: 我正在使用以下代码:

' Import Hourly stats
        DoCmd.TransferSpreadsheet transfertype:=acImport, SpreadsheetType:=10, _
        tablename:="Hourly", FileName:="C:\Filename\folder\stats* _
        Hasfieldnames:=True, Range:="AgentActivity!"

I have put the wildcard * at the end of the filename because the end half of the filename changes ever hour or so. 我将通配符*放在文件名的末尾,因为文件名的后半部分每小时都会更改一次。

When I run the code I get this error: 当我运行代码时,出现此错误:

The Microsoft access database engine could not find the object. Microsoft Access数据库引擎找不到该对象。 Make sure the object exists and that you spell its name and the path name correctly 确保对象存在,并且正确拼写了它的名称和路径名

Any help is appreciated. 任何帮助表示赞赏。

Looks like you are just missing the closing quote at the end of the filename. 看起来您只是在文件名末尾缺少右引号。

' Import Hourly stats
    DoCmd.TransferSpreadsheet transfertype:=acImport, SpreadsheetType:=10, _
    tablename:="Hourly", FileName:="C:\Filename\folder\stats*", _
    Hasfieldnames:=True, Range:="AgentActivity!"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM