I have a PivotTable form that I need users to be able to export to Excel, however menus are disabled for them, so I need to accomplish this via a button that runs a VBA event procedure. The problem I'm having is I can't duplicate the functionality the "Export to Excel" button in the PivotTable Tools Design menu has.
The code I've been trying has been something along the lines of:
The resulting file is just the unformatted data that would appear in the pivot. acCmdExportExcel seems to perform the same function as the Excel button in the Export section of the External Data tab. The button in the design menu does exactly what I want, I just can't figure out how to call it.Code:DoCmd.OpenForm "frmPCPivot", acFormPivotTable DoCmd.RunCommand acCmdExportExcel DoCmd.Close