Importing from Excel

C

Cyberwolf

I have an Excel Workbook that has multiply sheets. How would I import data
from each of the sheets in the workbook. I set it up using the
transferspreadsheet method, but can not figure out how to transfer each of
the worksheets.
 
K

Klatuu

The last argument in the TransferSpreadsheet is the range. Put the name of
the worksheet in that argument.
 
C

Cyberwolf

Ok, How do you format the worksheet name. WHen I just put the worksheet name
in parantheses is give me an error saying it can't be found

stTableName = WalmartStores
stDocName = "G:\Accounting\AR\AR Database\walmart stores.xls"
DoCmd.TransferSpreadsheet acImport, , "WalmartStores", stDocName, True,
"Wal-Mart Stores"
 
K

Klatuu

Your syntax is correct. Is one of the sheets named Wal-mart Stores? If you
got Error 3011, then either you misspelled the name, or it does not exist
within that workbook. If you got another error, please post back and be
specific with the error number and text. Also, what versions of Access and
Excel are you on?
 
Top