ImportExportSpreadsheet Macro

Dundee Lad

Active Member
Joined
Sep 6, 2003
Messages
311
Hi Board, I am using access 2013. I am trying to get the ImportExportSpreadsheet Macro to import one of the sheets in a work book. The sheet tab name changes but will always be 'Sheet2'. Do you know what I input into the range field to import this?
 
That sounds right to me, but I don't know and can't test it

what is the file connection string you have in its entirety

DoCmd.TransferSpreadsheet acImport, 10, "Tbl_Costs2", "Q:\Production Database\Tables\Tbl_Costs\2016_17 YTD.xlsx", True, "P1 Capex!"
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
AFAIK you cannot use anything but an actual sheet name (tab name) with the TransferSpreadsheet() function. You will have to use Excel automation to get the sheet name if all you know is its CodeName.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,820
Members
449,469
Latest member
Kingwi11y

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