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

前端 未结 3 925
一向
一向 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:16

    Here's the full module I used.

    Sub expotT()
     Dim td As DAO.TableDef, db As DAO.Database
     Set db = CurrentDb()
     For Each td In db.TableDefs
        If Left(td.Name, 4) <> "msys" Then
        DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
        td.Name, "C:\xExcelTables.xls", True, td.Name
        End If 
    Next
    End Sub
    

提交回复
热议问题