Importing Excel tabs in Access

G

Guest

Hi - I have a excel spreadsheet with 10 tabs and i would like to import only
2 of them which are randomly placed.

I would like to know how to import the specific tabs using the code

docmd.transferspreadsheet

Thanks for all the help.
 
G

Guest

Put the name of the spreadsheet tab in the Range argument of the
TransferSpreadsheet method.
 
G

Guest

I tried this, it is still importing the first tab.


DoCmd.TransferSpreadsheet acImport, , "tbl_West_ESPN", S:\File
Management\Automation\Autofall\PS1_WEST.xls, ,ESPN2

Is there anyting wrong with the above code?
 
G

Guest

It needs to be in quotes.
DoCmd.TransferSpreadsheet acImport, , "tbl_West_ESPN", S:\File
Management\Automation\Autofall\PS1_WEST.xls, ,"ESPN2"
 
G

Guest

When i run this with quotes, i have a run time error:
"The microsoft jet database could not find the object"

Here is the updated code:

DoCmd.TransferSpreadsheet acImport, , "tbl_West_ESPN", PathStr &
"PS1_WEST.xls", , "ESPN2"


Please advice. Thanks

:
 
G

Guest

Check the spreadsheet to be sure a sheet with the name ESPN2 exists and that
there are no leading or trailing spaces in it.
Also, you have it coded so that the spreadsheet has no field names in the
first row. Is that what you want?
 
G

Guest

Still same error!!. I even changed the name of the tab, but still no luck.

I do not have field name in the firstrow, so i have left it blank.

any other ideas.
Thanks for your patience.
 
G

Guest

Sorry, not having it in front of me I can't debug it. I know this works
because I use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top