Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Importing Multiple Worksheets into access

Posted on 2010-11-17
3
Medium Priority
?
521 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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 120

Expert Comment

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

Expert Comment

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

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

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

971 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