| Member with 138 posts. THREAD STARTER | | Join Date: Aug 2008 Experience: Beginner+ | |
Access 2007 VBA Function DoCmd.RunCommand acCmdPivotExportToExcel I have a vba function that I converted from a macro but the DoCmd.RunCommand acCmdPivotExportToExcel errors out in the function with runtime error 2501 - The RunCommand action was cancelled. Is there a different way I should be doing this? I am doing a few other things first and then it opens the query but stops. I need to export the pivot table to excel and keep the format of the pivot and I am showing only the top 10.
DoCmd.OpenQuery "CS Top 10 Query", acViewPivotTable, acEdit
DoCmd.RunCommand acCmdPivotExportToExcel |