2016-06-13 10 views
0

Ich befolge die Anweisungen hier http://software-solutions-online.com/excel-vba-export-worksheet-to-existing-access-table/, um Daten aus einer Excel-Tabelle in eine Access-Datenbank zu übertragen. Das Skript I angepasst ist:Übertragen Sie Excel-Daten zu 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 

Allerdings läuft das gibt mir eine Fehlermeldung,:

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.

Irgendwelche Vorschläge, auf denen diese das Problem? Ich bin ziemlich neu in Access und habe die Terminologie noch nicht ganz verstanden.

Antwort

1

Das Problem gefunden. Ich habe .accdb in meinen Access-DB-Dateinamen ausgelassen.

+0

Bitte markieren Sie Ihre Antwort als akzeptiert –

Verwandte Themen