0

我有一个包含一些数据的 excel 文件,我需要使用 VBA 将所有数据导入 MS Access,然后对其运行查询,最后将数据呈现在报告中。如何实现?

4

2 回答 2

2

参考: http: //office.microsoft.com/en-in/excel-help/import-excel-data-to-an-access-database-HP005200852.aspx

确保 Microsoft Excel 数据为列表格式:每一列在第一行都有一个标签并包含类似的事实,并且列表中没有空白行或列。

Close the Excel workbook that contains the data you want to use in Microsoft Access.

In Access, open the database where you want to copy the Excel data.

On the Access File menu, point to Get External Data, and then click Import.

In the Import dialog box, click Microsoft Excel in the Files of type box.

In the Look in list, locate the file you want to import, and then double-click the file.

Follow the directions in the Import Spreadsheet Wizard.

谢谢

于 2012-11-19T09:52:22.713 回答
0

使用 docmd.transterspreadsheet,如下所示:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml,tblName, impPath, False, impSheet

where tblName is table to add data to
      impPath is path and file name of excel workbook to import from
      false = no field names in import area (true =field name included in import area)
      sheet = sheet name and range ie "sheet!b5:j15"
于 2012-11-17T06:57:34.967 回答