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!
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

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

:)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,394
Members
414,234
Latest member
grlevesq

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