Exporting to Excel using TransferSpreadsheet

abenitez77

Board Regular
Joined
Dec 30, 2004
Messages
149
I have the code below that exports data to an excel file and creates a tab for each query ran. If It runs more than 5 TransferSpreadsheet commands then It error outs with Error 3011. It is not consistent. Sometimes it runs but other times it fails. It is in a Loop and it runs the line below 6 times and it bombs on me. Can't figure it out....


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Export_Query", Forms(currentform).Browse_LocationLabel.Caption & "\" & rs_grpid![GroupID] & "_" & rs_grpid![VendorName] & "_" & rs_grpid![VendorNumber] & ".xlsx", True, a_arr(i_arr)
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,830
Messages
6,121,831
Members
449,051
Latest member
excelquestion515

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