Stepping through worksheets using the TransferSpreadsheet acExport command.

I would like to import spreadsheet worksheets into Access by stepping through existing tabs.  

Example:
for i = 1 to 20
   DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
            "tbl_Temp" & i,  pathFileName,  True,  Worksheet !  i    
next

The tab names are not stable enough to hard code the tab names.  I would like to go to 1, 2, 3, etc.  I would also like to extract the names of these tabs, if possible.  If all else fails I will just open the spreadsheet using the excel object and work my way around that.

I can not get to my email until after 8:30 PM eastern time.  Because of restrictions at my J. O. B.  

    Thanks in advance!
WestBillWestAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
I think like this...:

for i = 1 to 20
   DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
            "tbl_Temp" & i,  pathFileName,  True,  Worksheet !  i  
    'Increment " i "
    i=i+1  
next i
0
Jeffrey CoachmanMIS LiasonCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
...thanks cap, I knew you had done this a few times, but I could not find the links...
0
WestBillWestAuthor Commented:
Makes sense, I was trying to make the TransferSpreadsheet command do too much.  Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.