DoCmd.TransferSpreadsheet method

bde7503

New Member
Joined
Dec 12, 2013
Messages
37
hi -

i currently use this method and it all works fine - the only issue is people complain because they have to type the range in each time - the workbook is loaded with sheets and the sheet name (the only sheet that needs imported) changes every week along with the number of rows

so i am trying to hard code it now and all the users need to do is manually change the name of the sheet before importing to...let's say MyHappySheet

but it doesn't seem to like this syntax

DoCmd.TransferSpreadsheet acImport, 10, "TempTable", CustomerFile, True, "MyHappySheet!E1:Z5000"


before i had a form that popped up with a text box (where the user would type out the sheet : range) that a public string variable (RangeVar) referenced .....like below.....and that worked just fine

DoCmd.TransferSpreadsheet acImport, 10, "TempTable", CustomerFile, True, RangeVar


not sure why - DoCmd.TransferSpreadsheet acImport, 10, "TempTable", CustomerFile, True, "MyHappySheet!E1:Z5000" - won't work the same way


thanks for any help!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

bde7503

New Member
Joined
Dec 12, 2013
Messages
37
actually it seems i just figured it out - apparently if you rename the sheet in excel but don't force the save first.....the sheet really isn't changed - and access still sees the prior sheet name

:)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,027
Messages
5,835,029
Members
430,332
Latest member
Charly_Moon

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
Top