Hi,
I have created a query with a Pivot table and am trying to export to excel with a specific file name to a specific directory. I coded this to export the file without a specific name or location and it works great:
DoCmd.OpenQuery "qry_Private_Brands_Pivot", acViewPivotTable, acEdit
DoCmd.RunCommand acCmdPivotTableExportToExcel, report_dir & FileName & timeStamp & ".xlsx", False, ""
DoCmd.Close acQuery, "qry_Private_Brands_Pivot"
But I couldn't get the RunCommand to allow a specific file name and location. So I replaced the runcommand with this TransferSpreadsheet statement and it gave me the error "A value you entered for the Transfer Type argument is invalid". (the report_dir and timestamp are already defined).
FileName = "PDF_ASSETS_Private_Brands_Pivot_"
DoCmd.TransferSpreadsheet acCmdPivotTableExportToExcel, 10, "qry_Private_Brands_Pivot", report_dir & FileName & timeStamp & ".xlsx", False, ""
Is there a different way to accomplish this?
Thanks!
C
I have created a query with a Pivot table and am trying to export to excel with a specific file name to a specific directory. I coded this to export the file without a specific name or location and it works great:
DoCmd.OpenQuery "qry_Private_Brands_Pivot", acViewPivotTable, acEdit
DoCmd.RunCommand acCmdPivotTableExportToExcel, report_dir & FileName & timeStamp & ".xlsx", False, ""
DoCmd.Close acQuery, "qry_Private_Brands_Pivot"
But I couldn't get the RunCommand to allow a specific file name and location. So I replaced the runcommand with this TransferSpreadsheet statement and it gave me the error "A value you entered for the Transfer Type argument is invalid". (the report_dir and timestamp are already defined).
FileName = "PDF_ASSETS_Private_Brands_Pivot_"
DoCmd.TransferSpreadsheet acCmdPivotTableExportToExcel, 10, "qry_Private_Brands_Pivot", report_dir & FileName & timeStamp & ".xlsx", False, ""
Is there a different way to accomplish this?
Thanks!
C