none
Output To Issue RRS feed

  • Question

  • I have the following code.

    DoCmd.OutputTo acOutputReport, V_stDocname, acExcel, , , , , acExportQualityPrint

    Even though I Have specified a output format (acExcel) I am given a dialog to specify output format.  Why is this?

    Monday, December 3, 2018 9:14 PM

Answers

  • "acExcel" is not one of the constants defined for OutputTo.  Try "acFormatXLS".

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by tkosel Monday, December 3, 2018 10:00 PM
    Monday, December 3, 2018 9:50 PM
  • While we are at it though, what if I wanted to save it as a XLSX format.  Can this be done with output to or do I need to use transfer spreadsheet?

    OutputTo cannot export to XLSX format.  For that you have to use TransferSpreadsheet. and specify (probably) acSpreadsheetTypeExcel12Xml .


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by tkosel Monday, December 3, 2018 10:10 PM
    Monday, December 3, 2018 10:05 PM

All replies

  • "acExcel" is not one of the constants defined for OutputTo.  Try "acFormatXLS".

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by tkosel Monday, December 3, 2018 10:00 PM
    Monday, December 3, 2018 9:50 PM
  • Dirk,

    As usual, thanks for the correction.  Seems like I often miss very simple things.  While we are at it though, what if I wanted to save it as a XLSX format.  Can this be done with output to or do I need to use transfer spreadsheet?

    Monday, December 3, 2018 9:59 PM
  • While we are at it though, what if I wanted to save it as a XLSX format.  Can this be done with output to or do I need to use transfer spreadsheet?

    OutputTo cannot export to XLSX format.  For that you have to use TransferSpreadsheet. and specify (probably) acSpreadsheetTypeExcel12Xml .


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by tkosel Monday, December 3, 2018 10:10 PM
    Monday, December 3, 2018 10:05 PM
  • Dirk,

    If I use transfer spreadsheet, I will not be able to use the report I am currently using right?   I will either have to create a query or put the data in a table right?  Will this still allow the user to specify where s/he wants the output to go or do I need to specify where it needs to go?

    Monday, December 3, 2018 10:25 PM
  • If you use TransferSpreadsheet, you won't be able to export a report directly;  TransferSpreadsheet only works for tables and queries.  Of course, if your report is based on a stored query that contains all the data, then you could export that query.

    Unfortunately, TransferSpreadsheet also won't prompt the user for the target file, so you need to do that yourself before you call TransferSpreadsheet. 


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Monday, December 3, 2018 10:51 PM