我目前有下面的代码,它将两个数据表保存到两个单独的工作表上的 Excel 工作簿中,然后打开工作簿:
Dim outputFileName As String
Dim outputFile As String
outputFile = "Export_" & Format(Date, "yyyyMMdd") & Format(Time, "_hhmm") & ".xlsx"
outputFileName = CurrentProject.Path & "\" & outputFile
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Callouts", outputFileName, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Members", outputFileName, True
'Load Excel
Set appExcel = New Excel.Application
Set wbkOutput = appExcel.Workbooks.Open(outputFileName)
'Show excel window
appExcel.Visible = True
我想添加一些代码来创建数据透视表以在 excel 中显示数据,但我不确定如何执行此操作 - 有人可以帮忙吗?:-)