Results 1 to 6 of 6
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071

    Docmd.Transferspreadsheet

    I have an Access 2010 Database that was created a few years ago that runs automated and executes a query exports that query to excel and emails the excel file to the people that need this data.



    The original VBA used the Docmd.transferspreadsheet function to export the query. Is there a newer function that allows the export to export to Excel 2010 format. the best the Docmd does is Excel 2000?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    It is in the spreadsheet type in the DoCmd statement, you specify which version of Excel.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The highest version offered is acSpreadsheetTypeExcel12. However, I find that the xlsx extension does not work. Have to use xls. Was this fixed in 2013 or 2016?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    An AcSpreadSheetType of "acSpreadsheetTypeExcel12" is for A2007. (with xlsx extension)
    For A2010, use an AcSpreadSheetType of "acSpreadsheetTypeExcel12Xml" (with xlsx extension)

    https://ss64.com/access/acspreadsheettype.html

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Rats! I knew I should have tested the Xml.

    Steve, did you mean to say: A2007. (with xls extension) ?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    From what I have read and understand, "acSpreadsheetTypeExcel12" is for A2007. (with xlsx extension)

    If you use "acSpreadsheetTypeExcel12" in A2010, there will be or seems to be problems opening the Excel workbook.
    I looked at a lot of posts and using "acSpreadsheetTypeExcel12" in A2007 seemed to work, but in A2010 caused problems opening the workbook.

    I'll look to see if I can resurrect a confuser with A2007 to do some testing....


    I started using "Docmd.OutputTo" instead of the Docmd.transferspreadsheet function. Then I use automation to format the Excel worksheet. I like it better.....
    The command for exporting a query to Excel worksheet looks like:
    Code:
    DoCmd.OutputTo acOutputQuery, "EQ_StatementMonthlyAll", acFormatXLSX, strSaveFileName, False
    I use folder picker code to select the folder where I want to save the file, then call the code to do the formatting and shazam!! Its done.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DoCmd.TransferSpreadsheet acExport Question
    By MTSPEER in forum Programming
    Replies: 5
    Last Post: 09-08-2016, 01:11 PM
  2. How do I use DoCmd.TransferSpreadsheet acExport
    By morerockin in forum Access
    Replies: 6
    Last Post: 09-24-2015, 03:28 PM
  3. Replies: 8
    Last Post: 07-02-2014, 10:58 AM
  4. Importing Excel file: ADODB, DAO or DoCmd.TransferSpreadsheet
    By Monterey_Manzer in forum Import/Export Data
    Replies: 3
    Last Post: 08-13-2013, 11:34 AM
  5. Replies: 4
    Last Post: 11-09-2011, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums