Access VBA backup all tables in Database to Excel

Access VBA backup all tables in Database to Excel

This VBA code will backup all your Access tables to Excel.  Each Access table will be a new tab in the Excel file that is created.  Basically this code will copy all your access tables to Excel.

 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, "X:\MyDocuments\BackupTables" & Format(Now, "yyyy.mm.dd_hhmm") & ".xls", True, td.Name
    End If
Next

 

Interested in learning new skills?