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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,217,394
Messages
6,136,349
Members
450,005
Latest member
BigPaws

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