Results 1 to 4 of 4
  1. #1
    dmgg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2014
    Posts
    42

    Export to Excel


    Using Office 2007. I am trying to export some data to Excel. I would like to send to a specific worksheet but am satisfied now if I can just export the data. The simplest method that I tried is:

    DoCmd.TransferSpreadsheet acExport, , "Query1", "C:\Users\Mine\Documents\TypesExamplesHints\Book1. xlsx", True

    I get no error message and the excel file update time shows that it was updated when I sent the data. But, there is no data in the spreadsheet! Query1 is not blank. It does have one row of data. What am I missing? Any help much appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    The code works for me. Cannot replicate issue. If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    to a SPECIFIC WORKSHEET, you must assign it...

    DoCmd.TransferSpreadsheet acExport, , "Query1", "C:\Users\Mine\Documents\TypesExamplesHints\Bo ok1. xlsx", True, "myWorksheet"

  4. #4
    dmgg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2014
    Posts
    42
    After reading your reply, I reinserted the program cd, ran the repair feature. And, just for extra' ran a decompile procedure I found on google. It works now, but embarrassingly, I must say that it may have worked before. Without the "Sheet1" on end of expression, I found that there was a new worksheet "query1" created in the workbook and it had the data. It may have been there before.

    Thank you so much for reply. I would just give up without this site.

    I am sending this to both moderators as I don't know if you see the other reply.


    Quote Originally Posted by June7 View Post
    The code works for me. Cannot replicate issue. If you want to provide db for analysis, follow instructions at bottom of my post.

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

Similar Threads

  1. Replies: 6
    Last Post: 10-04-2014, 12:22 PM
  2. Export PDF
    By ingarchsf in forum Programming
    Replies: 99
    Last Post: 09-17-2014, 04:41 AM
  3. Replies: 4
    Last Post: 06-04-2014, 01:25 PM
  4. Export as PDF
    By lugnutmonkey in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2013, 11:23 AM
  5. Export
    By vvasudev in forum Import/Export Data
    Replies: 2
    Last Post: 01-20-2010, 11:42 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