Consulting

Results 1 to 2 of 2

Thread: External Table not in expected format

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    May 2021
    Posts
    1
    Location

    External Table not in expected format

    I am attempting to export mutliple queries to excel. Each query should be a separate tab in the worksheet. I can run each query and export from access by simply using the export function without issue, but when i try to run as code below sometimes it works and other times i get "external table not in expected format error". This error occurs on a different table each time. Can anyone help? I am very very new with vba...

    Function Macro1()
    On Error GoTo Macro1_Err
    DoCmd.TransferSpreadsheet acExport, 10, "Export 1", "C:\Myfolder\DailyReport.xlsx", False, ""
    DoCmd.TransferSpreadsheet acExport, 10, "Export 2", "C:\Myfolder\DailyReport.xlsx", False, ""
    DoCmd.TransferSpreadsheet acExport, 10, "Export 3", "C:\Myfolder\DailyReport.xlsx", False, ""
    DoCmd.TransferSpreadsheet acExport, 10, "Export 4", "C:\Myfolder\DailyReport.xlsx", False, ""
    DoCmd.TransferSpreadsheet acExport, 10, "Export 5", "C:\Myfolder\DailyReport.xlsx", False, ""
    Macro1_Exit:
    Exit Function
    Macro1_Err:
    MsgBox Error$
    Resume Macro1_Exit
    End Function

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    It seems to me that it might be a performance issue.
    Try adding the DoEvents command after each DoCmd.TransferSpreadsheet ... (in a new line).
    Success cannot be guaranteed because Access is not my garden.

    Artik

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •