How to export all tables from an Access Database into Excel - A sheet for each table

前端 未结 3 853
一向
一向 2021-02-04 09:17

I have an Access database with ~30 tables.

How can I export all 30 tables into separate sheets in an Excel workbook?

I\'m hoping to find some VBA/VBS code which

3条回答
  •  被撕碎了的回忆
    2021-02-04 10:05

    You should be able to do something like this:

    Dim tbl as Tabledef
    For Each tbl in Currentdb.TableDefs
      DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, tbl.name, "PathName.xls", True, tbl.name
    Next
    

    The second tbl.name is the worksheet name.

提交回复
热议问题