2014-03-19 57 views
0
下面

是我用於將數據從有源片轉移到訪問表的代碼「訪問acc.DoCmd.TransferSpreadsheet方法引發錯誤

它引發以下錯誤

」運行時間錯誤2498

Sub AccImport() 
Dim acc As New Access.Application 
Dim rng As Range 
Set rng = ActiveSheet.Range("A1").CurrentRegion 
'MsgBox (rng.Address) 
acc.OpenCurrentDatabase "C:\Users\ksathis\Desktop\sample.accdb" 
acc.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "RETOUCH_WORKEDHOURS", ActiveWorkbook.FullName, True, rng 
acc.CloseCurrentDatabase 
acc.Quit 
Set acc = Nothing 
End Sub 

這是我訪問表怎麼看

enter image description here

這我Excel如何看片看在TransferSpreadsheet的 enter image description here

回答