Results 1 to 5 of 5
  1. #1
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67

    Overwite to exported Excel

    I'm having an issue overwriting to an existing EXCEL file. Here's the code:

    ofile = "\\corpshare\corp\Rev_Cycle_QA_Reports\Shared\NPI\ Daily\Daily Results.xlsx"


    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "t10_NPI_Import", ofile, True

    The file is not being overwritten nor does the date modified change to the existing file with the extension .xlsx.

    However, when I change the extension from .xlsx to an existing file with the extension .xlsb, the file does get overwritten and modified date is updated.

    I know my 1 option is to KILL the .xlsx before exporting, but can someone explain why .xlsb works and .xlsx doesn't work? I need the extension to be .xlsx because it's being imported into PowerBI.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Since nobody has answered, I'll offer a couple of thoughts. First, acSpreadsheetTypeExcel12Xml seems an odd option, but may not be a problem.

    This is more of a workaround than an answer, but I do all kinds of automated exports that will replace an existing file and I generally use OutputTo without issue.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940

  4. #4
    Dave_D's Avatar
    Dave_D is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    67
    Using the OutputTo worked perfectly. Thank you!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 08-07-2019, 02:57 PM
  2. How to set font for excel which is Exported from ACCESS
    By rmayur in forum Import/Export Data
    Replies: 5
    Last Post: 02-18-2015, 12:46 AM
  3. Truncated when exported to excel
    By memaxt in forum Import/Export Data
    Replies: 1
    Last Post: 09-05-2014, 12:58 AM
  4. Add VBA code to an Exported Excel Workbook
    By gasmaskman in forum Programming
    Replies: 13
    Last Post: 02-11-2014, 10:00 AM
  5. to open Exported Excel File
    By waqas in forum Programming
    Replies: 3
    Last Post: 10-16-2011, 12:33 PM

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