DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8 Error

rhjake23

New Member
Joined
Dec 20, 2017
Messages
35
Hello. I have the following.
Access DB (Office 365)
Excel (Office 365)

I am exporting a table (test) from an access DB. I use a macro to run the following command.
DoCmd.OpenQuery "030 - ABC"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "test", "C:\123.xls", True

Used to work all the time. Now I added a few columns of data to my 123 xls template and now i'm getting a "external table is not in the expected format"
I have since removed the newly added columns and I still get the error.

This has always ran in the past. Can I export from office 365 to an xls file? I need to stick to a xls version for particular reasons.
Is there some code that needs to be added? Are there references under tools that need to be selected?
Any input would be much appreciated.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I would say that it's your use of Excel8. You must have updated your version of Office, or at least Access and Excel? I'm not sure that specifying version 8 would work as Excel 365 is likely version 12 or higher. If you don't get a definitive answer here, try researching TransferSpreadsheet with respect to what Excel spec you need with your version.
 
Upvote 0
Maybe you can try removing the acSpreadsheetTypeExcel8

DoCmd.TransferSpreadsheet acExport, , "test", "C:\123.xls", True
 
Upvote 0
You might try exporting to an empty workbook just to test functionality. If that works, then maybe you would need to recreate the template or otherwise fiddle with your template and try to determine what's exactly the "unexpected format". Worst case (maybe not so bad really) is export to xlsx and then let Excel do the conversion to xls.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top