Solved

Importing Multiple Worksheets into access

Posted on 2010-11-17
3
496 Views
Last Modified: 2012-11-16
I am trying to Import some data from an excel spreadsheet using the TransferSpreadsheet method and I cannot seem to get the Worksheet part correct with the range.

I am using:  

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally2", fileName, False, "Excel_Export2"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally3", fileName, False, "Excel_Export3"

But it fails each time.
0
Comment
Question by:mjelec
  • 3
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34158639
is "Excel_Export1" the name of the worksheet?, add a Bang (!)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1!"
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34158645
add a Bang (!) sign to import the whole sheet.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34158701
to import a certain range  A1:K100

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "ExcelTally1", fileName, False, "Excel_Export1!A1:K100"
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now