我一直收到错误消息“外部表格不是预期的格式”尝试使用docmd transferspreadsheet导入时 [英] I keep getting the error message "External table is not in the expected format" when trying to import with docmd transferspreadsheet
问题描述
我希望你能帮助我。我编写了下面的vb代码,以便将特定工作表导入特定的表,但我不断收到错误消息"外部表格不是预期的格式"。我只是在访问中写了一些VB代码,所以我仍然不确定我是否在暗示某些不明智的东西。 excel中的表格和表格都具有相同的标题,并且都格式化为文本格式。
                                                
~~~~~~~~~~~~~~~
期权比较数据库
Private Sub Import()
DoCmd.TransferSpreadsheet acImport,3,"Tbl_1_ListOfMerchants",_
" C:\ Document and Settings \sophie.deslongchamps \ My Documents\auditwork.xls",True," mnlist!",HDR = yes
结束子
Sub to_import_data()
End Sub
非常感谢任何帮助
Sophie D.
Sophie B. div class ="h2_lin">解决方案
在第二个参数中指定3。这对应于 acSpreadsheetTypeLotusWK3 ,这对Excel工作簿无效。将$ 3替换为
acSpreadsheetTypeExcel8 。这是Excel 97-2003工作簿的类型。
Hi,
i hope that you can help me. I wrote the vb code below in order to import specific sheet to a specific table but I keep getting the error message "External table is not in the expected format". I have only written a few VB codes in access so I am still uncertain if I am mising something obsvious or not. both the table and the sheet in excel has identical headers and both are formatted as text format.
~~~~~~~~~~~~~~~
Option Compare Database
Private Sub Import()
DoCmd.TransferSpreadsheet acImport, 3, "Tbl_1_ListOfMerchants", _
"C:\Documents and Settings\sophie.deslongchamps\My Documents\auditwork.xls", True, "mnlist!", HDR = yes
End Sub
Sub to_import_data()
End Sub
Any help would be greatly appreciated
Sophie D.
Sophie B.
You specify 3 in the second argument. This corresponds to acSpreadsheetTypeLotusWK3, this is not valid for Excel workbooks. Replace 3 with acSpreadsheetTypeExcel8. This is the type for Excel 97-2003 workbooks.
这篇关于我一直收到错误消息“外部表格不是预期的格式”尝试使用docmd transferspreadsheet导入时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!