我现在有下面这节省了两个数据表到Excel工作簿中的两个独立的表,然后将代码打开工作簿:访问VBA:导出表到Excel 2010数据透视表
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中显示数据,但我不确定如何做到这一点 - 任何人都可以帮忙吗? :-)
你是什么意思的“格式电子表格成一个数据透视表“?你想创建一个基于数据表的数据透视表吗? – Barranka 2013-04-25 21:29:20
这可能是我想要做的,但我可能有术语错误 - 基本上我希望代码运行,以便在Excel打开时显示数据透视表中的导出数据。谢谢。 – duney 2013-04-25 21:32:53
好吧,让我试试另一种方式:你是否想根据表中已有的数据创建数据透视表,或者想要逐格格式化数据以显示某些内容*数据透视表? – Barranka 2013-04-25 21:44:21