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 can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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

:)
 
Upvote 0

Forum statistics

Threads
1,214,573
Messages
6,120,310
Members
448,955
Latest member
Dreamz high

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