我正在尝试将范围从Excel发送到Access Table。 Excel范围有20列,Access表有20个字段,顺序很好 我用过这段代码
adoConn.Execute "INSERT INTO OPT SELECT * FROM Range2Export"
Range2Export
被定义为具有20列的范围。
OPT
是我的访问表
我收到此错误:The Microsoft Access Database Engine cannot find the input table or query 'Range2Export'.
我使用了这个帮助http://support.microsoft.com/kb/257819,但没有帮助我。 如果有人可以帮忙 谢谢
答案 0 :(得分:0)
您希望您的Range2Export
存在于xlsx文件的上下文中。为此,您需要将其添加为命名范围,如此
Set Range2Export = Range(Cells(2, 2), Cells(LastRow, 41))
ThisWorkbook.Names.Add "Range2Export",Range2Export.Address