0
我按照此处的说明http://software-solutions-online.com/excel-vba-export-worksheet-to-existing-access-table/将数据从Excel电子表格传输到Access数据库。我已经适应了这个脚本是:将Excel数据传输到Access
Sub MailMerge2()
Dim strPath As String
Dim objAccess As Access.Application
Dim strExcelPath As String
strPath = "C:...Documents\MailMerge2"
strExcelPath = Application.ActiveWorkbook.FullName
Set objAccess = New Access.Application
Call objAccess.OpenCurrentDatabase(strPath)
objAccess.Visible = True
Call objAccess.DoCmd.TransferSpreadsheet(acImport, _
acSpreadsheetTypeExcel8, "MyTable1", strExcelPath, _
True, "A1:D11")
End Sub
但是,在运行这给了我一个错误说:
Run-time error: 7866, Microsoft Access can't open the database because it is missing, or opened exclusively by another user, or it is not an ADP file.
任何建议上的这些问题?我对Access很新,而且还没有完全掌握术语。
请将您的答案标记为已接受 –