You can use VBA to export an Access database table as a Worksheet in an Excel Workbook.
To obtain the path of the Access database, use the CurrentProject.Path
property.
To name the Excel Workbook file with the current date, use the Format(Date, "yyyyMMdd")
method.
Finally, to export the table as a Worksheet, use the DoCmd.TransferSpreadsheet
method.
Example:
Dim outputFileName As String
outputFileName = CurrentProject.Path & "Export_" & Format(Date, "yyyyMMdd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Table1", outputFileName , True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Table2", outputFileName , True
This will output both Table1 and Table2 into the same Workbook.
HTH
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…