TransferSpreadsheet如何导入excels中第二个表
参数中没有指定表选项参数.
[解决办法]
将Book1的Sheet1和Sheet2用TransferSpreadsheet方法导入Access mdb中。
Docmd.TransferSpreadsheet acImport, , "temp1 ", "C:\Book1.xls ", False, "Sheet1! "
Docmd.TransferSpreadsheet acImport, , "temp2 ", "C:\Book1.xls ", False, "Sheet2! "
[解决办法]
用
Docmd.TransferSpreadsheet acImport, , "TT ", "D:\Book1.xls ", False, "Sheet1$ "
OR
SELECT * FROM [EXCEL 8.0;DATABASE=D:\123.XLS].[SHEET1$]
[解决办法]
TransferSpreadsheet的语法:
Docmd.TransferSpreadsheet TransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOA
将Book1的Sheet1中的的A1到D10区域(含字段名)用TransferSpreadsheet方法导入Access的temp1表中:
Docmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "temp1", "C:\Book1.xls", True, "Sheet1!A1:D10"