我正在使用带有宏的 Excel 2010 来访问另一个每日电子表格以提取数据以形成 FTP 记录文件。我遇到的具体问题是运行时连接错误。我得到的错误是“-2147467259(80004005)”:无法识别的数据库格式“C:\Work\Daily FTP Process\Excel DBs and Files\ftp.xlsx”。我只需要它知道在哪里看。这是手表的连接字符串:
: ConnectionString : "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Work\Daily FTP >Process\Excel DBs and Files\ftp.xlsx;" : 字符串 : Module1.XLFixedFieldFile
这是相关(或不相关)的代码:
Dim conn As Object
Dim cmd As Object
Dim psidRecSet As Object
Dim loopIndex As Long
Dim connString As String
Dim sqlString As String
Set conn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
connString = "Provider=Microsoft.ACE.OLEDB.12.0;" _
& "Data Source=" & XLName & ";"
conn.Open connString <==== Here is the line where it is breaking