Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2019
    Posts
    1,046

    Export Access Tables into Excel Worksheets/Tabs

    Hello experts:

    I need some assistance with exporting all tables from an Access DB into a single XLSX spreadsheet (with separate worksheets for each Access table).

    Attached are 2 DB where DB_01 includes 2 tables + VBA module; and DB_02 includes 3 additional tables (to be copied into DB_01 for 2nd execution/test).

    Process #1:
    1. Open "DB_01" (which includes 2 tables).
    2. Open module 'M01_TransferTablesIntoExcel'... and run/execute the sub routine which shall create the XLS in the same directory.
    3. Open spreadsheet "REF_Tables.xls"... which should include 2 worksheets "TBL_FIRSTNAME" and "TBL_ITEMS".

    ... so far so good!



    Process #2:
    1. In "DB_01", delete the 2 tables.
    2. Open "DB_02" and copy all 3 tables into "DB_01".
    3. Open module 'M01_TransferTablesIntoExcel'... and run/execute the sub routine.
    4. Open the XLS again.

    What should have happened:
    - XLS should show the 3 tables from "DB_02".

    However, what did happen:
    - While the 3 DB_02 tables were exported into the XLS, it also included the 2 *deleted* tables from original DB_01.
    - While testing the VBA multiple times, the original DB_01 tables sometimes also displayed worksheet names equal to, e.g., "~TMPCLP169361" or "~TMPCLP169521"

    My question:
    - How should the VBA export routine be modified so that only the existing tables (not hidden and/or deleted ones) are exported into the XLS/XLSX?
    - Also, I tried using "acSpreadsheetTypeExcel12Xml (vs. acSpreadsheetTypeExcel9) to get the export into current format "XLSX". That threw an error though. What's the correct syntax for exporting into XLSX format as well?
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 6
    Last Post: 07-23-2020, 11:32 AM
  2. Replies: 4
    Last Post: 07-29-2015, 06:30 AM
  3. Replies: 3
    Last Post: 03-16-2014, 08:09 PM
  4. Replies: 12
    Last Post: 12-17-2012, 12:47 PM
  5. Export Filtered Results to Excel Tabs
    By opod in forum Programming
    Replies: 1
    Last Post: 08-03-2011, 01: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