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很新,而且還沒有完全掌握術語。
請將您的答案標記爲已接受 –